I'm attempting to write a jquery script that moves my nav to the left and right depending on the position of the mouse.
It works ok, but when it moves back to the right (left:1), it doesn't move all the way some times. I have to really be deliberate with my mouse.
var navMiddle = 680;
var navUl = $('#pbnav');
var position = navUl.position();
if (e.clientX > navMiddle)
if (e.clientX < navMiddle)
if(position.left < 0)
Any tips on how to make this more efficient, and run smoother, would be appreciated.