changing size of nyromodal window

2020-06-27 12:47发布

问题:

This script waits till user presses the button so nyromdal starts

$('.image_upload').nm({
    sizes: {minW:10,minH:10 },
    modal: false,
  closeOnClick: false
        });

Then in after press script, after changing content of nyromodal window I'm trying to change the size of window but it does not changes it immediately so the size remains old, scroll bars appear. And new size affect window only if you close the window and call it back again.

This code puts new content into nyromdal window

$('.nyroModalDom').html(responseimage);

And here we have 2 ways of changing the size. Both work only after close-reopen of window, not immediately.

1

$.nyroModalSettings({
width: 800,
height: 800
});

2

$.nmObj({
width: 800,
height: 800
});

So how can I change the size of window without reopen ?

UPDATE

Have found just now new function but it also fails to resize the window. Scroll bars disappear as if window wants to resize but it remains the same and scroll bars appear again.

$('.nyroModalDom').resize();

回答1:

You can try to use this instruction:

$.nmTop().resize(true);

that is, in my experience, the right way to performe the resizing.

UPDATE

You can adjust the height using the callback afterResize adding code like this:

$('.image_upload').nm({
    callbacks: {
        afterResize: function(nm) {                
           // to adjust according to your needs                
           $('nyroModalCont').css('height', $('.nyroModalDom img').height());
        }
    }
});