如何在Kendo UI中创建类转换效果?

时间:2012-09-09 09:08:04

标签: javascript jquery jquery-ui effects kendo-ui

我工作的公司正在考虑用Kendo UI取代jQuery UI 我个人认为没有任何好处,我也发现Kendo UI的文档严重缺乏。

例如,在jQuery UI中,有一些很好的类转换效果:http://jqueryui.com/docs/Effects/Methods#Class_Transitions

这些效果的Kendo UI等价物是什么?

1 个答案:

答案 0 :(得分:3)

kendo.fx.js中有kendoAddClass,kendoRemoveClass和kendoToggleClass,它们在可用时使用CSS3过渡,而在没有时直接替换。它们尚未记录,因为动画直接使用CSS完成,只能通过从元素中删除过渡来停止。

经过检查,似乎jQuery插件在2012年第二季度破坏了(构建710)。我已修复它们,下周将修复该服务包。与此同时,您仍然可以使用用于驱动它们的kendo.toggleClass()方法。它的用法是这样的:

kendo.toggleClass(element, classes, options, toggle);

element: jQuery object
classes: one or more classes to apply (separated by a space)
options: {
    exclusive: "all",
    duration: 400,
    easing: "ease-out"
} - options is optional, can be omitted, the values up there are default and fed to the transition CSS property, duration is in ms.
toggle: add/remove the class.

从下周的服务包开始,您可以直接使用它:

$("#test").kendoAddClass(classes, options);

哦,忘了添加jsBin demo