我正在使用 SimpleModal Jquery 插件,效果很好!
但是,有时模态 div 的宽度和高度需要更改,所以我需要模态在页面中心自动重新定位。我发现 SimpleModal 使用它的 setPosition() 函数来做到这一点。它在模态启动时自动调用。
因此,当模态 div 的尺寸发生变化时,我尝试调用上述函数,但它不起作用:
$('#mybutton').click(function() {
//code here to resize the modal
$.modal.impl.setPosition(); //doesn't work. note that at this point, the modal is still active (displayed)
});
你有什么想法?