模态中的 Javascript 后退按钮 - 阻止它关闭模态
如何让演示中看到的“后退”按钮不关闭模式窗口?
如果无法阻止这种情况,那么至少向他们提供一个确认框,提醒他们窗口正在尝试关闭,并询问他们是否要继续。
我使用 JavaScript 后退按钮链接和前进按钮链接来控制模式/灯箱窗口内的用户历史记录。
这是正在发生的事情的演示...开始时,第二页将有一个指向模式窗口的链接,因此单击该链接,然后单击窗口中的“后退”按钮,因为它将带您返回到起始页。这就是我遇到的问题,因为我不希望这种情况发生。
http://www.apus.edu/_test/evan/modal/start。嗯
<a href="javascript:history.go(-1)">Back Button</a>
<a href="javascript:history.go(1)">Foward Button</a>
How do I get the "back" button seen in my demo to NOT close the modal window?
If this can't be prevented, then at least provide them with a confirmation box alerting them the window is trying to close and ask them if they want to continue.
I'm using a javascript back button link and forward button link to control the user's history inside a modal/lightbox window.
Here's a demo of what is happening... When you begin, the second page will have a link to the modal window, so click that, then click the "back" button in the window as it will take you BACK to the start page. That's the issue I'm having as I don't want this to happen.
http://www.apus.edu/_test/evan/modal/start.htm
<a href="javascript:history.go(-1)">Back Button</a>
<a href="javascript:history.go(1)">Foward Button</a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以看到它们在页面中的位置(即:具有静态后退/前进按钮的起始页),为什么不直接将后退按钮设为 javascript:void(0) 呢?如果您不打算定义前面的位置,请使用服务器端存储它们的起始位置,一旦它们到达该位置,请禁用后面的选项。
If you can see where they are in the page (ie: the start page having a static back / forward button ) why not just make the back button a javascript:void(0)? If you aren't going to have a defined front location, use server side to store their start place, and once they have reached it, disable the back option.