jQuery .toggleClass()速度 [英] jQuery .toggleClass() speed

查看:443
本文介绍了jQuery .toggleClass()速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery .toggleClass()函数,每次单击都会切换类,效果很好,但是我无法设置速度,我已经尝试过了:

I use jQuery .toggleClass() function, class will toggled per click, that works perfectly, but i can't setup speed, i have tried this:

$('#databox').toggleClass('boxopened', 7000);

这也是

$('#databox').toggleClass('boxopened', 'easeInQuad');

以及以下内容: http://forum.jquery. com/topic/hover-and-toggleclass-fail-at-speed

我添加了最新的 jquery 1.10 jqueryUI:1.10.3

可以设置速度吗?

推荐答案

确保您包含JQuery UI效果-基本的JQuery不允许在show/hide/toggle上进行过渡,它是UI效果的扩展. (在您的应用或浏览器控制台中,尝试running $.ui.version)

Ensure that you are including JQuery UI Effects - the base JQuery does not allow transitions on show/hide/toggle, it's added as an extension from UI Effects. (In your app, or in browser console, try running $.ui.version)

http://api.jqueryui.com/toggleClass/

$.ui.version => "1.10.3"(您请求的版本)上为我工作.这是一个演示: http://jsfiddle.net/yKFjA/1/

Works for me on $.ui.version => "1.10.3" (the version you requested). Here's a demo: http://jsfiddle.net/yKFjA/1/

您希望看到哪些正在应用的样式更改动画?

What styling changes are being applied that you wish to see animated?

这篇关于jQuery .toggleClass()速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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