html Jquery Mobile页面滑动

时间:2013-07-03 10:03:00

标签: jquery ipad mobile swipe

任何人都可以让我走向正确的方向,在网站上获得3页,并整合来自JQuery mobile的滑动元素,对于iPad使用我已经成功地从第一页(介绍)到下一页(概述)和返回..但是无法从(概述页面)swipeleft进一步滑入网站到第三页(属性)...继承人我的代码:

第一页......

<script type="text/javascript">
$(function () {
        $("body").live('swiperight', function (event, ui) {
            $.mobile.changePage("introduction.html", "slide");
        });

        $("body").live('swipeleft', function (event, ui) {
            $.mobile.changePage("overview.html", "slide");
        });
    });
</script>

第二页......

<script type="text/javascript">
$(function () {
        $("body").live('swiperight', function (event, ui) {
            $.mobile.changePage("introduction.html", "slide");
        });

        $("body").live('swipeleft', function (event, ui) {
            $.mobile.changePage("properties.html", "slide");
        });
    });
</script>

1 个答案:

答案 0 :(得分:1)

当您使用changePage时,jQuery mobile不会将您发送到新页面。它只会抓取新页面的部分(在您的情况下是正文)并加载到当前页面。

因此,在第一次滑动后,第二页加载但所有参数仍然来自第一页。进一步滑动就像试图加载已经加载的第二页......没有进一步的动作。

你可以做些什么,例如, 使用唯一ID包装每个页面内容 <div id="firstpage">...</div> 在您的JavaScript中,将其更改为:

$("#firstpage").live('swiperight', function (event, ui) {
        $.mobile.changePage("introduction.html", "slide");
    });