开发者

jQuery: animate function causing long delay when used down a list

开发者 https://www.devze.com 2023-02-27 23:49 出处:网络
I have a list of about 26 <section> tags that include some other divs and information. I have it so when you click on a share button, these extra options get shown in that same <section> t

I have a list of about 26 <section> tags that include some other divs and information. I have it so when you click on a share button, these extra options get shown in that same <section> tag. When you click on the share button, this is the jQuery js I use:

selectedPost.animate({
  left: -selectedPostWidth
}, 200, function(){
});
sharePost.animate({
  left: 0
}, 200, function(){
  // some stuff
});

Now however this is where it gets odd. When you click on one of the buttons inside the share div it plays the reverse animation like so:

selectedPost.animate({
  left: 0
}, 200, function(){
});
sharePost.animate({
  left: 9999
}, 200, function(){
  sharePost.hide();
});

So in my list of <section> tags,开发者_C百科 the first one works fast and no delay. However, once you start moving down the list, the delay get's greater and greater. Until you have about a 4-5 second delay. This only happens on the close function animations, not the open one.

I hope I have explained everything alright, if not I'll add more detail. Thanks for any help!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号