Jquery Mobile 1.4外部面板导航到其他页面后不打开 [英] Jquery Mobile 1.4 external panel do not open after navigating to other page

查看:118
本文介绍了Jquery Mobile 1.4外部面板导航到其他页面后不打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用jquery mobile和apache cordova开发移动应用程序。在迁移到jquery mobile 1.4.0后,我们切换到外部面板,但面板有一个问题。

We are developing an mobile application using jquery mobile and apache cordova. After migrating to jquery mobile 1.4.0 we switched to external panel but there is a problem with the panel.

有一个简单的例子,说明 http: //jsfiddle.net/Q58MZ/3/

There is a simple example of the problem in http://jsfiddle.net/Q58MZ/3/

要重现问题,您必须:
1从菜单链接点击page1
2从菜单链接点击page2
3从菜单链接点击page1
4从菜单链接点击page2
5点击GO TO PAGE 1链接内容

To reproduce the problem you must: 1 click on page1 from the menu link 2 click on page2 from the menu link 3 click on page1 from the menu link 4 click on page2 from the menu link 5 click on "GO TO PAGE 1" link in the content

然后菜单将打开它将添加类,它打开,但它不会打开。

Then the menu wont open it will add classes that its open but it wont open.

示例代码重现它:

<html>
<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css" />
    <script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>  
    <script>
        $(document).ready(function() {
            $.mobile.defaultPageTransition = 'none';
            $("#mypanel").panel();
        });
        $(document).bind('panelbeforeopen', function(e, data) {
            console.log("before open");
        });
        $(document).bind('panelbeforeclose', function(e, data) {
            console.log("before close");
        });
    </script>
</head>
<body>
    <div data-role="panel" id="mypanel">
        <a href="#page1">page1</a>
        <br />
        <a href="#page2">page2</a>
    </div>
    <div data-role="page" id="page0">
        <div data-tap-toggle="false" data-role="header" >
            <a href="#mypanel">menu</a>
            <h1>PAGE 0</h1>
        </div>
        <div data-role="content"> 
            PAGE 0
        </div>
        <div data-tap-toggle="false" data-role="footer" >
        </div>
    </div>
    <div data-role="page" id="page1">
        <div data-tap-toggle="false" data-role="header" >
            <a href="#mypanel">menu</a>
            <h1>PAGE 1</h1>
        </div>
        <div data-role="content"> 
            PAGE 1
        </div>
        <div data-tap-toggle="false" data-role="footer" >
        </div>
    </div>
    <div data-role="page" id="page2">
        <div data-tap-toggle="false" data-role="header" >
            <a href="#mypanel">menu</a>
            <h1>PAGE 2</h1>
        </div>
        <div data-role="content"> 
            PAGE 2
            <a href="#page1">GO TO PAGE 1</a>
        </div>
        <div data-tap-toggle="false" data-role="footer" >
        </div>
    </div>
</body>

奇怪的是,我浏览面板链接面板工程,但当我点击链接,不是在面板,它不会再打开了。我们也尝试了$ .mobile.changePage和新的与:pagecontainer,但它是一样的。如果有人有类似的问题,请让我知道他是如何解决的。
提前感谢。

The strange thing is that when I navigate through the panel links the panel works but when I click to link that is not in the panel it wont open anymore. We tried also with $.mobile.changePage and the new one with the :pagecontainer but it is the same. If someone have similar problem please let me know how he fix it. Thanks in advance.

推荐答案

Omar是对的 $。mobile.defaultPageTransition ='none'; 导致问题,当我删除它的一切工作。

Omar is right the $.mobile.defaultPageTransition = 'none'; is causing the problem when I removed it everything works.

这篇关于Jquery Mobile 1.4外部面板导航到其他页面后不打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆