消除弹跳球的弹跳效果 [英] Eliminate bouncing ball effect on slidetoggle

查看:98
本文介绍了消除弹跳球的弹跳效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎它处于几个循环中,然后稳定下来.此人在此视频中遇到了类似的问题: http://www.youtube.com/watch?v = KCFeImyBzfE

It seems like it's in a bit of a loop for a few and then it stabalizes. This person had a similar problem in this video: http://www.youtube.com/watch?v=KCFeImyBzfE

此外,此代码的另一个问题是,一旦显示曲目列表,然后再次将其隐藏,这些单词就会停止切换.最后说隐藏跟踪列表",它们已经被隐藏了.

Also, another problem with this code is that once you show the tracklist, then hide it again, the words stop toggling. it ends up saying "hide tracklist" and they are already hidden.

<script type="text/javascript">
$(document).ready(function() {
   $('.fullTracks').hide();
   $('.tracklist').click(function() {
      $('.fullTracks').slideToggle('medium');
      if ($('.fullTracks').is(':hidden')) {
         $(this).text('Show Tracklist');
      } else {
         $(this).text('Hide Tracklist');
      }
   });
});
</script>

推荐答案

这是因为先前的滑动效果尚未完成,因此排队等待多次触发.

That is because the previous sliding effect has not finished yet, so it queues up to be fired multiple times.

slideToggle()之前尝试.stop().这将删除以前的所有事件,然后触发一个新事件.

Try the .stop() before the slideToggle(). This will remove any previous events and then fire a new one.

来源

http://api.jquery.com/stop/

这篇关于消除弹跳球的弹跳效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆