Skip to content
This repository was archived by the owner on Mar 19, 2020. It is now read-only.
This repository was archived by the owner on Mar 19, 2020. It is now read-only.

Resize problem. #2

@aritz007

Description

@aritz007

There is a problem with resize, because is beaking other code/freamworks. I have changed rhis two functions, show and hide, take a look:

function show() {
    if (isShown) {
        return;
    }
    divMsgBox.css({ opacity: 0, top: top - 50, left: left });
    divMsgBox.css("background-image", "url('"+msgBoxImagePath+"msgBoxBackGround.png')");
    divMsgBoxBackGround.css({ opacity: options.opacity });
    options.beforeShow();
    divMsgBoxBackGround.css({ "width": $(document).width(), "height": getDocHeight() });
    $(divMsgBoxId+","+divMsgBoxBackGroundId).fadeIn(0);
    divMsgBox.animate({ opacity: 1, "top": top, "left": left }, 200);
    setTimeout(options.afterShow, 200);
    $("#" + firstButtonId).focus();
    isShown = true;
    $(window).resize(resizer);
}
function resizer(e) {
        var width = divMsgBox.width();
        var height = divMsgBox.height();
        var windowHeight = $(window).height();
        var windowWidth = $(window).width();

        var top = windowHeight / 2 - height / 2;
        var left = windowWidth / 2 - width / 2;

        divMsgBox.css({ "top": top, "left": left });
        divMsgBoxBackGround.css({"width": "100%", "height": "100%"});
}
function hide() {
    if (!isShown) {
        return;
    }
    options.beforeClose();
    divMsgBox.animate({ opacity: 0, "top": top - 50, "left": left }, 200);
    divMsgBoxBackGround.fadeOut(300);
    setTimeout(function () { divMsgBox.remove(); divMsgBoxBackGround.remove(); }, 300);
    setTimeout(options.afterClose, 300);
    //$(window).unbind("resize");
    $(window).off("resize", resizer);
    isShown = false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions