如何使用浏览器后退按钮关闭引导模式而不是返回页面?` [英] how to close a bootstrap modal with the browser back button instead of going back a page?`

查看:17
本文介绍了如何使用浏览器后退按钮关闭引导模式而不是返回页面?`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这是智能手机的一个问题,它可能与台式机有关.我们已经修改"了我们的引导程序模态以使其具有响应性,但是当它在智能手机上显示为全屏时,用户认为模态是一个页面并单击返回以关闭"它.我们在右上角的 X 中包含了 ,但也希望后退按钮关闭模态.有人有什么想法吗?

I have found this an issue with smartphones and it can relate to desktops. We have 'modded' our bootstrap modal to be responsive, however when displayed on a smartphone it is in full screen, the user assumes the modal is a page and clicks back to 'close' it. We have included the in the top right X but would also like the back button to close the modal. Anyone have any ideas?

谢谢

推荐答案

最简单的方法是让用户感觉它的弹窗或模型不是一个新页面,通过使用一些边距或使其 span10 offset1 之类的.

Easiest way is to make user feel that its pop-up or model not a new page, by using some margins or making it span10 offset1 kind of.

另一种方法是打开和关闭方法,描述了 这里

Another way around is Open and Close method which is described here

最好的方法是

<SCRIPT type="text/javascript">
   window.history.forward();
   function noBack() { window.history.forward(); }
</SCRIPT>
</HEAD>
<BODY onload="noBack();"onpageshow="if (event.persisted) noBack();" onunload="">

此处描述

为了从 iFrame 控制后退按钮,试试这可能会有所帮助(未测试)

for controlling back button from iFrame, try this may help (not tested)

<SCRIPT type="text/javascript">
   window.parent.history.forward();
   function noBack() { window.parent.forward(); }
</SCRIPT>
</HEAD>

这篇关于如何使用浏览器后退按钮关闭引导模式而不是返回页面?`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆