Scrollbar problem with jQuery UI dialog in Chrome and Safari

前端 未结 9 1395

I\'m using the jQuery UI dialog with modal=true. In Chrome and Safari, this disables scrolling via the scroll bar and cursor keys (scrolling with the mouse whee

9条回答
  •  臣服心动
    2020-12-08 04:39

    I workaround this situation by disabling dialog modal mode and showing overlay manually:

    function showPopup()
    {
        //...
    
        // actionContainer - is a DIV for dialog
    
        if ($.browser.safari == true)
        {
            // disable modal mode
            $("#actionContainer").dialog('option', 'modal', false);
    
            // show overlay div manually
            var tempDiv = $("
    "); tempDiv.css("background-color", "#000"); tempDiv.css("opacity", "0.2"); tempDiv.css("position", "absolute"); tempDiv.css("left", 0); tempDiv.css("top", 0); tempDiv.css("width", $(document).width()); tempDiv.css("height", $(document).height()); $("body").append(tempDiv); } // remove overlay div on dialog close $("#actionContainer").bind('dialogclose', function(event, ui) { $("#tempOverlayDiv").remove(); }); //... }

提交回复
热议问题