最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is possible to have more granular control over jQuery UI Dialog Widget's showhide method? - Stack Overflow

programmeradmin2浏览0评论

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({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:

$('#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.


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.

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({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:

$('#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.


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.

Share Improve this question edited Feb 27, 2012 at 9:32 newtonapple asked Feb 10, 2009 at 7:20 newtonapplenewtonapple 4,1333 gold badges35 silver badges31 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

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

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

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

Note that there is a dependency on effects.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.

What works however is:

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

This is currently not Possible with 1.6 and 1.7.1.

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论