弹出/按钮(jQuery mobile)的页面重定向问题

时间:2013-08-27 13:38:06

标签: jquery-mobile

我创建了一个按钮

<a data-role="button">

在弹出窗口内。这是Popup:

<div data-role="popup" id="popupRegister" data-theme="a" data-dismissible="false">
    <div data-role="header" data-theme="b" class="ui-header ui-bar-b" 
             role="banner">
        <h1 class="ui-title" role="heading" aria-level="1">Success!!</h1>
    </div>
    <div data-role="" data-theme="a" class="ui-body-a" 
       role="main" style="padding:15px;">
      <h1>Thank you for regestering with us.</h1>
      <p>You may now continue to the app.</p>

       <!-- this is the button -->
      <a href="#" id="takeMeHome" data-role="button" data-rel="back" 
       data-theme="a" data-inline="true" 
       data-corners="true" data-shadow="true" 
       data-iconshadow="true" data-wrapperels="span" 
       class="ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-up-a">
       <span class="ui-btn-inner"><span class="ui-btn-text">GO</span></span>
      </a>       
     </div>
</div>

单击按钮时,console.log正在响应,但页面未重定向。为什么? 以下是我重定向的方式:

$("#takeMeHome").click( function(){
    console.log("lets go home");
    //window.location.href = "home.html";
    //localStorage.registered=true;
    //window.location.replace("home.html");
    window.location.href = ("home.html");
});

1 个答案:

答案 0 :(得分:3)

替换

window.location.href = ("home.html");

$.mobile.changePage('home.html');

data-history="false"添加到弹出式div。