So I’ve got four circles next to each other, and when you move the mouse from one to the other, this code activates. But I only want it to activate when you move off/on any of the circles, not when you move from one .circle to another. Thanks folks!
$('.circle').hover(
function () {
$(this).parent().animate({marginLeft: '-=25px'}, 1000);
},
function () {
$(this).parent().stop(true, true).animate({marginLeft: '+=25px'}, 1000);
}
);
check out this fiddle… http://jsfiddle.net/WxNdN/3/
e.relatedTarget should give you the element that you have entered or left. Check its class to see if it is a circle before firing your animation.