Slideup 和 Slidedown 具有不同的内容 buggy jquery

发布于 2024-12-24 15:57:50 字数 433 浏览 3 评论 0原文

我在使用 jquery 的 jquery .slideUp() 和 .slideDown() 函数时遇到了一些小问题。我目前在 div 标签中显示一些信息,并且有一些隐藏的表单。

我想要完成的是,当我单击链接时,显示的当前信息将向上滑动(隐藏),然后向下滑动和一个表单(已隐藏)。

这是可行的,但是当我再次执行此操作以显示原始文档并隐藏表单时,它会出现一些问题,因为表单的高度有点长。因此它想要扩展到表单的高度长度,然后急速恢复到原始信息的大小。我试图在 jsfiddle 上显示它,但似乎它在那里工作,但在我的网站上不起作用。还有另一种方法可以做到这一点,也许是更好的方法,或者有人知道会出现什么问题吗?

http://jsfiddle.net/3jyFK/7/

谢谢

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?

http://jsfiddle.net/3jyFK/7/

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

§普罗旺斯的薰衣草 2024-12-31 15:57:50

尝试使用animate方法而不是slideUpslideDown,这种方法更灵活。

Try to use animate method instead of slideUp or slideDown, this method is more flexible.

粉红×色少女 2024-12-31 15:57:50

使用 .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文