简体   繁体   中英

SimpleModal: window resize causes scrollbar and redraw of modal content

I have a modal that looks like I want it to when it first loads. To set the size and position in the onShow callback I'm using:

$j('.discount-msg').click(function () {
    event.preventDefault();

    modalWindow = $j('#crosssell-modal').modal({
        containerId: "cross-sell-container",
        autoResize: true,
        //maxWidth: 698,
        onShow: function (dialog) {
            dialog.container.css({"height":"auto","width":"auto"})
            this.setPosition();

            $j("#closeCrossSellModal", dialog.data).click(function () {
                $j.modal.close();
            });
        }
    });
});

When a user resizes the browser window though the modal resizes the content width and it breaks over to a new line and creates a scrollbar.

Is there a onResize callback or a way to trigger an event from outside of the modal function?

I think I've figured this out.

In the CSS, if I put a width: auto , and height: auto !important this works as I'm expecting it to. I really don't like using the !important , but that's what it's for I guess.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM