简体   繁体   English

实现jQuery UI切换缓动功能

[英]Implementing jQuery UI toggle easing function

I'm beginning to use the jQuery UI, and I'm trying to use an easing function other than the default ones available with the .toggle() effect in jQuery. 我开始使用jQuery UI,并且我正在尝试使用除jQuery中的.toggle()效果可用的默认函数之外的缓动函数。

This is what I have now. 这就是我现在拥有的。 How do I adjust this to use one of the easing functions from the UI, for example the 'explode' function? 如何调整它以使用UI中的一个缓动函数,例如'explode'函数?

$(document).ready(function() {
   $('#signin').click(function(e) {
      $('#signinbox').toggle(300);
   });
});

per the docs: http://api.jqueryui.com/toggle/ 根据文档: http //api.jqueryui.com/toggle/

.toggle( effect [, options ] [, duration ] [, complete ] ) .toggle(效果[,选项] [,持续时间] [,完成])

 $('#signinbox').toggle('explode', 300);

Must include appropriate jqueryUI.js resources as this won't work with jQuery core toggle() method 必须包含适当的jqueryUI.js资源,因为这不适用于jQuery core toggle()方法

Try like this: 试试这样:

$('#signin').click(function(e) {
    $('#signinbox').toggle('explode', 300);
});​

jsFiddle example jsFiddle例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM