jquery mobile повторное отображение внутренней страницы - PullRequest
0 голосов
/ 29 июля 2011

Внутренняя страница отображается правильно, но когда я возвращаюсь на эту страницу после отображения всплывающего диалогового окна, страница пуста.

<!DOCTYPE html> 
<html> 
    <head> 
        <title>Test</title> 
        <meta name="viewport" content="width=device-width, initial-scale=1"/> 

        <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
        <link href="js/jquery.mobile-1.0b1.css" rel="stylesheet" type="text/css" />   
        <script src="js/jquery.mobile-1.0b1.js" type="text/javascript"></script>   
        <script src="js/test.js" type="text/javascript"></script>
    </head> 
<body> 

<div data-role="page" id="program">
    <div data-role="header" data-nobackbtn="true">
        <h1>Test Page</h1>
    </div><!-- /header -->
      <div data-role="content" data-theme="a" id="listChoices">
      <div data-role="controlgroup" id="possible">
         <a href="#" data-role="button" id="choice1" class="response">1</a>
         <a href="#" data-role="button" id="choice2" class="response">2</a>
         <a href="#" data-role="button" id="choice3" class="response">3</a>
         <a href="#" data-role="button" id="choice4" class="response">4</a>
      </div>
    </div><!-- /content -->
    <div data-role="footer" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF">
        test (c) 2011
    </div><!-- /footer -->
</div><!-- /page -->

<div data-role="page" id="popup">
    <div data-role="header" data-nobackbtn="true" data-theme="e">
        <h1>How did I do?</h1>
    </div><!-- /header -->
      <div data-role="content" data-theme="d">

     <label id="msg" style="margin-right:auto;margin-left:auto; text-align:center; font-family:@Arial Unicode MS; font-size:large"></label>
    <div id="Div5" style="width:200px;margin-right:auto;margin-left:auto"><input id="btnReturn" type="button" value="Continue" /> </div>

    </div><!-- /content -->
    <div data-role="footer" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small; color: #FFFFFF">
        Test (c) 2011
    </div><!-- /footer -->
</div><!-- /page -->

</body>
</html>     

var msg
$(document).ready(function ()
{
  $("[class^='response']").click(function ()

    {
        var t = this.id.replace('choice', '');
            $("#msg").html('You pressed number '+ t);
            $.mobile.changePage("#popup", { transition: "flip" });
    });
    $('#btnReturn').click(function ()
    {
        $("#popup").hide()
        $.mobile.changePage("#program", { transition: "flip" });
    });
}); 

1 Ответ

0 голосов
/ 29 июля 2011

Избавьтесь от этой строки:

$("#popup").hide();

Вы скрываете всплывающее окно, поэтому при переключении на него div скрывается.

http://jsfiddle.net/j6BGp/12/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...