简体   繁体   中英

how to change page in multipage hybrid app file using $.mobile.changePage()?

in my hybrid app, i'm trying to change page in a multipage file using jquery mobile function changePage. when i press the button it hides current pages and shows blank page. same if i'm hidding/showing divs using hide/show jquery functions. it works perfect in pc web browsers. but in mobile app. how can i change/show second page?

here is my code:

<head>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script src="js/jqtouch/jqtouch.js" type="application/x-javascript"
charset="utf-8"></script>
<link type="text/css" rel="stylesheet" media="screen"
href="js/jquery.mobile-1.1.0.min.css">
<link type="text/css" rel="stylesheet" media="screen"
href="js/jquery.mobile.theme-1.1.0.min.css">
<link type="text/css" rel="stylesheet" media="screen"
href="js/jquery.mobile.structure-1.1.0.min.css">
<script type="text/javascript" charset="utf-8" src="js/wormhole.js"></script>
<script type="text/javascript" charset="utf-8"
src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" charset="utf-8"
src="js/jquery.mobile-1.1.1.js"></script>
</head>
<body>
<div id="TaskList" data-role="page">
    <div data-role="header">
        <h1>Dienos užduotys</h1>
    </div>
    <script type="text/javascript">
        function showTaskDetails(id) {
            $.mobile.changePage("#taskDetails", {
                transition : "slideup"
            });
        }
    </script>
    <div data-role="content">
        <div id="task_list" data-role="controlgroup">
                 <a data-role="button" onclick="showTaskDetails(1)" href="#">Name</a>
        </div>
    </div>
</div>
<div id="TaskDetails" data-role="page">
    <div data-role="header">
        <a href="#TaskList" data-icon="arrow-l" data-iconpos="left"
            data-rel="back">Atgal</a>
        <h1>Dienos užduotys</h1>
    </div>
    <div data-role="content">
        <input type="text" value="" id="task_id" />
    </div>
    <div data-role="footer"></div>
</div>
</body>

UPDATE: seems like the problem appeared because of changePage function that is in login file.

If you have multiple pages of documents, only need to do this:

$.mobile.changePage("#taskDetails", {transition : "slideup"});

$.mobile.changePage("file1.html", {transition : "slideup"});
$.mobile.changePage("file2.html", {transition : "slideup"});
......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM