我有JavaScript在任何/每个页面上打开一个对话框(这只是一些文本,没有别的)有人登陆我的网站(是的,我知道这是一个JavaScript风格的混合 - 仍然得到与此交手):jquery手机对话关闭在历史中关闭
$(document).bind("pageinit", function(){
if(getCookieValue('instructionseen') == false)
{
$.mobile.changePage("/php/instructions_alert.php");
document.cookie ="instructionseen=yes; path=/;";
}
});
该脚本会设置Cookie,使用户只能看到对话框一次。所以你的想法是你来到现场,与一些instrctions对话,关闭它,并继续。
Chrome v24中的问题(我担心它可能出现在我无法测试的移动浏览器中)是,关闭对话框会使我回到历史记录中的2页,所以我回到页面链接我点击进入我的网站。
例如,说我的网站是MS,并且它通过RS(引荐网站)
Desired: RS > click to MS > Dialog opens > close it > MS in view
On Chrome: RS > click to MS > Dialog opens > close it > back to RS
出现这种情况使用JQM提供的X,或这种密切的钮我提供链接到:
<a href='#' onclick='$(".ui-dialog").dialog("close");' data-role='button' data-theme='c'>Close</a>
对话框来源:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<title>title..</title>
<link rel='stylesheet' href='/design/mobile_style.css'>
<link rel='stylesheet' href='http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css' />
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script src='/js/main_and_JQM_init.min.js'></script>
<script src='http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js'></script>
</head>
<body>
<div data-role='dialog' id='instructions_alert_div' data-overlay-theme='b'>
<div data-role='header' data-theme='d'>
<h1>Important!</h1>
</div>
<div data-role='content' data-theme='c'>
content, just text...
<a href='#' onclick='$(".ui-dialog").dialog("close");' data-role='button' data-theme='c'>Close</a>
</div>
</div>
</body>
</html>
谢谢
忘了说,这是JQM 1.2最后的 – KevInSol 2013-02-26 18:32:15
你可以发布对话框的标记吗? – Omar 2013-02-26 22:09:48
@Omar - 发布了对话框。你在一周或两周前帮助我解决了类似的问题,没有太多对话的运气! – KevInSol 2013-02-27 11:58:32