通过缓动切换 div
我有一个链接,当单击此链接时,我想要一个 div 通过缓动滑入,然后再次单击该链接,它应该通过缓动关闭 div...
我看过 jQuery 缓动插件,但它没有不能与 jQuery 1.5.1 一起使用吗?对我能做什么以及如何做有什么想法吗?
现在我只有一个 SlideToggle 函数,它没有缓动功能?
$('.open-mypage').click(function () {
$('#mypage-info').slideToggle('2000', function () {
// Animation complete.
});
});
I've got a link, when clicking this I want a div to slideIn with easing, and then clicking the link again, it should close the div, with easing...
I've looked at jQuery easing plugin, but it doesn't work with jQuery 1.5.1? Any ideas to what I can do, and how?
Right now I only got a slideToggle function, which doesn't have easing?
$('.open-mypage').click(function () {
$('#mypage-info').slideToggle('2000', function () {
// Animation complete.
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jQuery slideToggle() 文档 说:
正如你所看到的,有一个名为
[ easing ]
的参数,它的描述是:因此,您有 2 个选择:
1)您使用可用的缓动之一:
2)您在页面中包含 jQuery UI 并使用其 32 种缓动之一:
您可以在此处查看 jsFiddle 示例
jQuery slideToggle() documentation says :
As you can see, there's a parameter called
[ easing ]
, its description is :So you have 2 choices :
1) You use one the available easing :
2) You include jQuery UI in your page and use one of its 32 easings :
You can see a jsFiddle example here
从下拉列表中选择效果类型,单击时,这会使切换效果看起来更好。
我试过了,效果很好。
Select the effect type from the drop down and when click,this makes a toggle effects that looks a lot better.
I have tried, It working fine.