javascript - 切换类动画 Jquery UI

标签 javascript jquery css html jquery-ui

我正在尝试以不同的方法将此 ( http://webdesignerwall.com/demo/html5-grayscale/) 与 css 和 jquery ui 集成。到目前为止,我正在尝试 jquery ui 的 switch 类方法,但是效果的持续时间,即第三个参数,不起作用或者我错误地理解了那个东西。

$('.grayscaled').hover(function () {
    $(this).switchClass( "grayscaled", "nongrayscaled", 1000);
}, function () {
    $(this).switchClass( "nongrayscaled", "grayscaled", 1000);
});

我已经为我所做的创造了 fiddle

http://jsfiddle.net/vLLgb/1/

最佳答案

将此添加到 .grayscaled:

-webkit-transition: all 1000ms;

关于javascript - 切换类动画 Jquery UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23045370/

相关文章:

javascript - 如何在没有 try/catch block 的情况下处理 javascript 中未捕获的异常?

javascript - React Native 中的热重载和实时重载有什么区别?

javascript - 无法从通过 jQuery 创建的元素调用 jQuery 中的 css 类

html - 无法让 3 个 DIV 在容器内彼此相邻

javascript - 跨域网址

javascript - jQuery - 多个元素类型上的每个循环

当文本框的只读值自动更改时调用的jquery事件

jquery - 具有特定高度的分割 table

javascript - 使用普通 JS 显示/隐藏 div

css - Less Guard 没有按预期工作