是否可以更精细地控制jQuery UI Dialog Widget的show / hide方法?

时间:2022-11-01 14:16:54

Currently it seems that I can only use effects in their most basic form when using the Dialog widget. For example, the following will use the drop effect for both showing and hiding the dialog box:

目前似乎我只能在使用Dialog小部件时以最基本的形式使用效果。例如,以下将使用放置效果显示和隐藏对话框:

$('#dialog').dialog({show:'drop', hide:'drop'});

However, the default for the drop method always drops to the left. What I really want is for it to drop to the right. Something like this:

但是,drop方法的默认值始终下降到左侧。我真正想要的是让它向右倾斜。像这样的东西:

$('#dialog').dialog({
   show:{effect:'drop', direction:'right'},
   hide:{effect:'drop', direction:'right'}
});

Is this possible?

这可能吗?

I'm currently using 1.6rc6. I've also tried it 1.5.3 (stable) without any luck.

我目前正在使用1.6rc6。我也试过1.5.3(稳定)没有任何运气。


After digging into the source a bit, I don't think this is supported in both version 1.5.3 and 1.6rc*. It'll probably require a change to the API before the functionality above can be supported. Steerpike has found a version that probably should be in the mainline. If anyone knows otherwise, do correct me.

在深入挖掘源代码之后,我认为版本1.5.3和1.6rc *都不支持。在支持上述功能之前,可能需要更改API。 Steerpike发现了一个可能应该在主线上的版本。如果有人不知道,请纠正我。

3 个解决方案

#1


Actually, you can use any of the jQuery UI effects; e.g. pulsate:

实际上,您可以使用任何jQuery UI效果;例如搏动:

$("#dialog").dialog({ show: "pulsate" });

There are plenty to be found here: http://docs.jquery.com/UI/Effects/

这里有很多东西可以找到:http://docs.jquery.com/UI/Effects/

Note that there is a dependency on effects.core.js.

请注意,effect.core.js存在依赖关系。

I tried passing an option (like you did) into 'show', it didn't work. I also tried to make 'show' a function, no luck avail.

我尝试将一个选项(就像你做的那样)传递给'show',它没有用。我也试图让'show'成为一个功能,没有好运。

What works however is:

然而,有效的是:

$("a").click(function() {
    $("#dialog").hide("drop", { direction: "right" }, 1000);
});

#2


This is currently not Possible with 1.6 and 1.7.1.

目前1.6和1.7.1不可能。

#3


You may find this link of dialog box examples useful. In particular the second one from the right. I'm not sure if it's using the standard dialogue plugin, but you should be able to figure it out from the examples they use.

您可能会发现此对话框示例链接很有用。特别是右起第二个。我不确定它是否使用标准对话插件,但您应该能够从他们使用的示例中找出它。

#1


Actually, you can use any of the jQuery UI effects; e.g. pulsate:

实际上,您可以使用任何jQuery UI效果;例如搏动:

$("#dialog").dialog({ show: "pulsate" });

There are plenty to be found here: http://docs.jquery.com/UI/Effects/

这里有很多东西可以找到:http://docs.jquery.com/UI/Effects/

Note that there is a dependency on effects.core.js.

请注意,effect.core.js存在依赖关系。

I tried passing an option (like you did) into 'show', it didn't work. I also tried to make 'show' a function, no luck avail.

我尝试将一个选项(就像你做的那样)传递给'show',它没有用。我也试图让'show'成为一个功能,没有好运。

What works however is:

然而,有效的是:

$("a").click(function() {
    $("#dialog").hide("drop", { direction: "right" }, 1000);
});

#2


This is currently not Possible with 1.6 and 1.7.1.

目前1.6和1.7.1不可能。

#3


You may find this link of dialog box examples useful. In particular the second one from the right. I'm not sure if it's using the standard dialogue plugin, but you should be able to figure it out from the examples they use.

您可能会发现此对话框示例链接很有用。特别是右起第二个。我不确定它是否使用标准对话插件,但您应该能够从他们使用的示例中找出它。