SimpleModal Jquery插件位置问题

发布于 2024-09-07 11:52:16 字数 337 浏览 1 评论 0原文

我对这个线程有同样的问题: 关于SimpleModal jQuery插件的问题——初始打开后可以重新居中吗?

我尝试了可能的解决方案,但没有成功。我的页面有一个滚动条,打开模式后,我有一些调整 div 大小的操作。但是当div超出窗口可见区域时,超出的内容将被隐藏。当我滚动页面时,模式保持在同一位置!

它在 IE6 上运行良好,在 IE8 上运行良好。

I have the same problem of this thread: Question about SimpleModal jQuery plugin -- possible to re-center after initial open?

I tried the possible solution, but no success. My page have a scrollbar and after I open the modal, I have some action that resize the div. But when the div exceed the window visible area, the exceeded content is hidden. When I scroll the page the modal stay on the same position!

Its works well on IE6, not no on IE8.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最舍不得你 2024-09-14 11:52:16

我建议设置 max-height 和 max-width 以防止对话框变得太大。然后,您可能需要确保此 div 的样式包含 overflow:scroll

I would suggest setting max-height and max-width to keep the dialog from growing too large. Then you may need to make sure that the styling for this div includes overflow:scroll.

拥抱我好吗 2024-09-14 11:52:16

可能的解决方案的示例:

$('#modalContent').modal({
    onShow: function (dialog) {
        var sm = this;

        // bind click event to get ajax content
        $('.link', dialog.container[0]).click(function (e) {
            e.preventDefault();

            $.ajax({
                ..., // your settings here
                success: function (data) {
                    dialog.data.html(data); // put the data in the modal
                    dialog.container.css({height:'auto', width:'auto'}); // reset the dimensions
                    sm.setContainerDimensions(); // resize and center modal

                    // if you want to focus on the content:
                    sm.focus();

                    // if you want to rebind the events
                    sm.unbindEvents();
                    sm.bindEvents();
                }
            });
        });
    }
});

我将考虑在 SimpleModal 中放置一个调整大小函数,它将处理大部分这些步骤。在那之前,这应该对您有用。

-埃里克

Example of a possible solution:

$('#modalContent').modal({
    onShow: function (dialog) {
        var sm = this;

        // bind click event to get ajax content
        $('.link', dialog.container[0]).click(function (e) {
            e.preventDefault();

            $.ajax({
                ..., // your settings here
                success: function (data) {
                    dialog.data.html(data); // put the data in the modal
                    dialog.container.css({height:'auto', width:'auto'}); // reset the dimensions
                    sm.setContainerDimensions(); // resize and center modal

                    // if you want to focus on the content:
                    sm.focus();

                    // if you want to rebind the events
                    sm.unbindEvents();
                    sm.bindEvents();
                }
            });
        });
    }
});

I'm going to look into putting a resize function in SimpleModal, which would take care of most of these steps. Until then, this should work for you.

-Eric

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文