开发者

Strange jQueryUI dialog error

开发者 https://www.devze.com 2022-12-22 04:03 出处:网络
I have dialog created like this $(\'#add_error\').click(function(e) { $(\'<div>\') .load(\'/someaction/format/html/\')

I have dialog created like this

$('#add_error').click(function(e) {
        $('<div>')
            .load('/someaction/format/html/')
            .dialog({
                title: 'Some title',
                modal: true,
                width: 385,
                close: function() {
                     $(this).remove();
                }
            });

        e.preventDefault();
    });

It works ok, but every third (not really sure if its really third) time I click link to open dialog, it fails with error in firebug

"$("").addClass("ui-widget-overlay") is undefined"

In dialog.js that is piece of code:

var $el = (this.oldInstances.length ? this.oldInstances.splice(0, 1)[0] : $('<div></div>').addClass('ui-widget-overlay'))
                .appendTo(document.body)
                .css({
                    width: this.width(),
                    height: this.height()
                });

under create: function(dialog) method.开发者_如何学运维

Strange thing is that this error does not occur when I remove

close: function() {
                     $(this).remove();
                }

Any idea?


This has been fixed in trunk since 1.8rc3. See http://dev.jqueryui.com/ticket/5263


I think it got to be connected to the: ui-widget-overlay in some strange way.

I just override it in my page like this: .ui-dialog-titlebar { display: none; } .ui-widget-overlay { background: #888888; opacity:.15;filter:Alpha(Opacity=15); }

and the reason to override ui-widget-overlay is just because the following doesn't work .ui-dialog-overlay { background: #888888; opacity:.15;filter:Alpha(Opacity=15); }


Everithing works with jQuery UI 1.8

0

精彩评论

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

关注公众号