2013-05-27 121 views
1

我是Phonegap/jQuery手机中的新手,在页面转换问题中我正面临白屏。我试图应用我在网络上找到的许多解决方案(例如-webkit-backface-visibility:hidden;),但仍未解决问题。Phonegap/jQuery手机页面转换闪烁

我也设置了defaultPageTransitionnone(在jQuery mobile .js文件中),而且什么也没有。

我不能关闭硬件加速,因为我需要它为我的iDangerous swiper菜单。我的所有链接如下所示:

<a href='javascript:void(0)' class='news-main' onclick='someFunction()'>Some String</a> 

当我点击链接someFunction()被调用。方法someFuction看起来像这样:

function someFunction(){ 
    //setting some value that I need in next page 
    window.sessionStorage.setItem("someValue",someValue); 
    window.location="next-page.html"; 
} 

一切正常,除了在页面转换期间出现白色闪烁。它仅在某些设备上显示(例如Android 4+)。

有什么办法可以解决这个问题吗?或者,也许我做错了什么?提前致谢!

+0

见http://stackoverflow.com/a/16692917/104746 ---将视口设置为user-scalable =没有解决我的问题。 –

回答

1

尝试如下

<a href='#' class='news-main' id='mylink'>Some String</a> 

JS

$(document).on('pagecreate', function(){ 
    $('#mylink').bind('click',function(){ 
     someFunction() 
    }); 
}); 

function someFunction(){ 
    window.sessionStorage.setItem("someValue",someValue); 
    $.mobile.changePage("next-page.html"); 
} 
+0

谢谢我按照你的说法写下来并解决了问题。谢谢! – Kolovrat

0

你可以写你的链接,

<a href='javascript:void(0)' class='news-main' onclick='someFunction()' data-transition="none" >Some String</a> 

为jQuery Mobile的不是网页很流畅transitions.Hence我们可以选择为了现在直到最后版本的jquery mobile与普通的页面转换关闭它们ASED。

+0

我也试图把数据转换:没有在我的链接,但不幸的是没有帮助。 Mayu Mayooresan给出的解决方案帮助了我。感谢您的建议。 – Kolovrat

2
android:hardwareAccelerated="false" 

打开你的清单,并粘贴此内部应用程序标记。因为你的设备的硬件加速打电话每次

3

你需要的东西之前调用jQuery Mobile的JS这样做:

<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script> 
       <script type="text/javascript"> 
       $(document).bind("mobileinit", function() 
       { 
        if (navigator.userAgent.indexOf("Android") != -1) 
        { 
        $.mobile.defaultPageTransition = 'none'; 
        $.mobile.defaultDialogTransition = 'none'; 
        } 
       }); 
       </script> 
       <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> 

这就是足够 refer

1
<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script> 
       <script type="text/javascript"> 
       $(document).bind("mobileinit", function() 
       { 
        if (navigator.userAgent.indexOf("Android") != -1) 
        { 
        $.mobile.defaultPageTransition = 'none'; 
        $.mobile.defaultDialogTransition = 'none'; 
        } 
       }); 
       </script> 
       <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script>