【问题标题】:How to change the jQuery effect duration time in button event如何在按钮事件中更改 jQuery 效果持续时间
【发布时间】:2014-02-25 17:55:10
【问题描述】:

我在我的 UI 对话框上设置了显示和隐藏效果:

show: {
  effect: "blind",
  duration: 600
},
hide: {
  effect: "explode",
  duration: 1000
},

我也有一些按钮,我想设置不同的效果来按下它们并关闭对话框。问题是效果显示得太快了。

这是我的按钮代码:

buttons: {
  Yes: function () {
    $(this).dialog("option", "hide", "explode").dialog("close");
  },

.dialog("option",...,...)方法中如何设置效果持续时间?

【问题讨论】:

    标签: jquery jquery-ui jquery-ui-dialog


    【解决方案1】:

    您可以将定义效果和持续时间的对象作为第三个参数传递:

    buttons: {
        Yes: function () {
            $(this).dialog("option", "hide", {
                effect: "explode",
                duration: 100
            }).dialog("close");
        },
    

    查看此Fiddle 以获取演示

    【讨论】:

    • 谢谢,这正是我想要的。
    猜你喜欢
    • 2018-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-18
    • 2023-01-17
    • 1970-01-01
    • 1970-01-01
    • 2020-12-27
    相关资源
    最近更新 更多