想要在关闭 Shadowbox 后引发回发

发布于 2024-11-25 12:42:22 字数 609 浏览 1 评论 0原文

我有一个网站,它使用 Shadowbox-JS 在用户单击时显示设置页面在一个小图标上。这些设置使用户能够自定义他们在主应用程序中查看的内容的视图。

设置页面是一个完整(但紧凑)的 .aspx 页面,其中包含要应用的设置、更新到数据库、从数据库读取等的所有相关代码,因此这一切都是动态的。我想要的是一旦用户关闭影子盒就发生回发,以便主页上的视图自动更新以反映他们的更改。

一旦用户在设置区域中按下“保存”,就会出现以下链接:

<a onclick="window.parent.location.href = window.parent.location.href;">Settings saved.  Please close this window</a>

这基本上只是刷新整个页面,当然,在此过程中,阴影框不再存在。这种方法工作正常,但问题是用户还可以选择通过单击阴影框外部来关闭阴影框。我需要在发生这种情况时进行捕获,并在发生这种情况时导致回发(或页面刷新),以便无论设置如何,当阴影盒关闭时始终应用。

I have a site which uses Shadowbox-JS to bring up a settings page when a user clicks on a little icon. The settings are there for the user to be able to customise their view of what they're looking at in the main application.

The settings page is a full (but compact) .aspx page which has all the relevant code for the settings to be applied, updated to a database, read from a database etc, so that's all nicely dynamic. What I want is for a postback to occur once the user closes the shadowbox so that the view on the main page automatically updates to reflect their changes.

The following link appears once the user presses 'save' in the settings area:

<a onclick="window.parent.location.href = window.parent.location.href;">Settings saved.  Please close this window</a>

This basically just refreshes the whole page and of course, in the process the shadowbox is no more. This approach works fine but the problem is the user also has the option to close the shadowbox by clicking outside of it. I need to capture when this happens and cause a postback (or page refresh) when this happens so that no matter what the settings are always applied when the shadowbox is closed.

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

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

发布评论

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

评论(1

身边 2024-12-02 12:42:22

我找到了答案,我需要向 Shadowbox.init() 函数添加一个选项,如下所示:

Shadowbox.init({
    onClose: function () {
        window.location.href = window.location.href;
    }
});

I've found the answer, I needed to add an option to the Shadowbox.init() function as follows:

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