jquery clickling fast
Posted
by Johansrk
on Stack Overflow
See other posts from Stack Overflow
or by Johansrk
Published on 2010-03-28T18:49:50Z
Indexed on
2010/03/28
18:53 UTC
Read the original article
Hit count: 287
Hi. I have this function, that adds 31px to my style bottom on ul. It works fine, but if I click fast, it no longer adds 31px, but some weird number like 17.423px. I guess it's because the animation isn't done, and thereby by clicking fast it adds 31px to the current px amount. My thought is that I need to insert a stop(). But where?
Thanks
$(function () {
$('.topTenTwocolumns .topTenTwocolumnsWrap .down').click(function () {
if ($("ul").css("bottom") !== '2728px') {
$(this).parents('.topTenTwocolumnsWrap').children('ul').stop().animate({
bottom: '+=31'
}, 200);
}
});
});
© Stack Overflow or respective owner