.animate callback executing twice??
Hi All,
First post here and I'd really appreciate some help with an odd phenomenon I'm experiencing with the .animate() function.
What I'm trying to do is implement a wicked window scrolling method that I found here:
http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12
Basically I'm wanting a nested animation, ie do A first then B, so in my example, after the window has scrolled down, I then animate a div to open.. however the callback function code within the // secondary animate comments is executed twice.
Here's my code:
$('.getInTouchTab a').click(function (){
// scroll down
var targetOffset = $('#getInTouchTab').offset().top;
$('html,body').animate({
scrollTop: targetOffset
},
750,
'easeInOutQuad',
function () {
// secondary animate start
$('.getInTouch').animate({
height: 'toggle'
},
500,
'easeInOutQuad'
);
// secondary animate end
}
);
return false;
});
I'm using jQuery 1.4.2.
Any help would be great received.
Regards,
James