Slideup 和 Slidedown 具有不同的内容 buggy jquery
我在使用 jquery 的 jquery .slideUp() 和 .slideDown() 函数时遇到了一些小问题。我目前在 div 标签中显示一些信息,并且有一些隐藏的表单。
我想要完成的是,当我单击链接时,显示的当前信息将向上滑动(隐藏),然后向下滑动和一个表单(已隐藏)。
这是可行的,但是当我再次执行此操作以显示原始文档并隐藏表单时,它会出现一些问题,因为表单的高度有点长。因此它想要扩展到表单的高度长度,然后急速恢复到原始信息的大小。我试图在 jsfiddle 上显示它,但似乎它在那里工作,但在我的网站上不起作用。还有另一种方法可以做到这一点,也许是更好的方法,或者有人知道会出现什么问题吗?
谢谢
I have a slight glitch working with jquery .slideUp() and .slideDown() function from jquery. I'm currently showing some information in a div tag, and I have some forms that are hidden.
What I'm trying to accomplish is that when I click a link, the current information shown will slideUp (to be hidden), then slideDown and a form (that was hidden).
This works, but when I do it again to show the original document and hide the form, it gets a little buggy because the form is a little longer in height-wise. So it wants to expand to the height length of the form and then jerk back to the size of the original information. I tried to show it on jsfiddle, but it seems like it works there, but it doesn't work in my site. Is there another way of doing this, maybe a better way or does anybody know what would be the problem?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用
animate
方法而不是slideUp
或slideDown
,这种方法更灵活。Try to use
animate
method instead ofslideUp
orslideDown
, this method is more flexible.使用 .slideToggle() 代替并与 .stop() 结合使用:
http://jsfiddle.net /idmontie/3jyFK/11/
希望这可以解决您的问题。
编辑:快速单击“编辑”文本时似乎仍然存在问题。解决此问题的一种方法是在每次单击后重置 CSS 属性。
Use .slideToggle() instead and use .stop() in conjunction with it:
http://jsfiddle.net/idmontie/3jyFK/11/
Hopefully this solves your problem.
EDIT: There still appears to be a problem when the "Edit" text is clicked rapidly. A way to get around this is to reset the CSS properties after each click.