改变 nyromodal 窗口的大小

2022-01-17 00:00:00 modal-dialog jquery javascript nyromodal

这个脚本一直等到用户按下按钮,所以 nyromdal 开始

This script waits till user presses the button so nyromdal starts

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

然后在按下脚本后,在更改 nyromodal 窗口的内容后,我试图更改窗口的大小,但它不会立即更改它,因此大小保持旧,出现滚动条.只有当您关闭窗口并再次调用它时,新的大小才会影响窗口.

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.

此代码将新内容放入 nyromdal 窗口中

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 ?

更新

刚刚找到了新功能,但也无法调整窗口大小.滚动条消失,好像窗口要调整大小,但它保持不变,滚动条再次出现.

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();

推荐答案

你可以试试这个指令:

$.nmTop().resize(true);

也就是说,根据我的经验,执行调整大小的正确方法.

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

更新

您可以使用回调 afterResize 添加如下代码来调整高度:

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());
        }
    }
});

相关文章