开发者

Make a jQuery modal-dialog behave like an alert()

I've got a modal dialog popping up via jQuery, but I would like it to behave like a regular js alert in that a) if you are on another tab it will bring the bro开发者_如何学Gowser's focus back to the page with the alert and b) an alert sound "ding!" will be played.

Is this possible?

Here is my dialog box:

var $newCandleDialog = $('<div></div>')
        .load('/prodash/dash_access.php?urlInit=candles/getCanStatus.php','it='+newData)
        .dialog({
            autoOpen: false,
            title: 'Active Mode: New Candles!',
            modal: true,
            buttons: {
                "Load new candles": function() {
                    $("#canHint").load('/prodash/dash_access.php?urlInit=candles/getcandles.php','q=0&show=05&strength=00');
                    $( this ).dialog( "close" );    
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }
        });


For focus you can use: this.focus();

For sound please take a look into SoundManager 2 Javascript's library.
Uses Flash where HTML5 is not supported.

Hope it helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜