jQuery animate

Hi all,

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.

the code:


$('#navwrap').mousemove(function(e){
		var navMiddle = 680;
		var navUl = $('#pbnav');
		var position = navUl.position();
		if (e.clientX > navMiddle)
		{
			navUl.stop();
			navUl.animate({
				left: '-60'
			});
		}
		if (e.clientX < navMiddle)
		{
			navUl.stop();
			if(position.left < 0)
			{
				navUl.animate({
					left: '1'
				});
			}
		}
		
	});

Any tips on how to make this more efficient, and run smoother, would be appreciated.

Thanks!