简体   繁体   English

删除JQuery Mobile上的默认淡入淡出过渡

[英]Remove default fade transition on JQuery Mobile

I'm developing a mobile app with Phonegap using Jquery Mobile. 我正在使用Jquery Mobile使用Phonegap开发移动应用程序。 First I tried to normally add a transition to a < a > tag using: 首先,我尝试使用以下方法通常向<a>标记添加过渡:

    <a href="#page2" data-transition="slide">Page 2</a>

just like it's explained on JQuery Mobile documentation, but I noticed that my page was doing a fading animation before actually doing the slide, and of course it looked horrible. 就像在JQuery Mobile文档中解释过的一样,但是我注意到我的页面在实际制作幻灯片之前已经在进行淡入淡出的动画处理,当然它看起来太恐怖了。 After that happened I thought it was because there's a default animation so I looked for ways to remove it, and I found this: 在那之后,我以为是因为有一个默认的动画,所以我寻找删除它的方法,然后发现了这一点:

    <script>
        $(document).bind("mobileinit", function(){
        $.mobile.defaultPageTransition = 'none';
        });
    </script>

But it still isn't working. 但它仍然无法正常工作。 I also tried to change the default transition to slide but it didn't work either. 我还尝试将默认过渡更改为可滑动,但也没有用。 Thanks for your time, any ideas? 谢谢您的宝贵时间,有什么想法吗?

The ordering of the mobileinit handler is important. mobileinit处理程序的顺序很重要。 It must go between your jQuery main file and the jQuery Mobile file 它必须在您的jQuery主文件和jQuery Mobile文件之间

<!-- jQuery.js -->
<script type="text/javascript" src="assets/js/plugins/jquery-2.1.1.min.js"></script>

<!-- Place after jQuery.js but before jQueryMobile.js -->
<script type="text/javascript" src="assets/js/app.js"></script>

<!-- jQueryMobile.js -->
<script type="text/javascript" src="assets/js/plugins/jquery.mobile-1.4.4.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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