【问题标题】:Transitions jumpy in jQuery mobile phoneGapjQuery手机中的过渡跳跃Gap
【发布时间】:2014-04-29 07:43:00
【问题描述】:

我正在使用 Phonegap Build 和 jquery mobile 1.4.2 开发一个 ios 应用程序。我正在使用以下脚本来修复页面之间跳跃和闪烁的过渡:https://github.com/jquery/jquery-mobile/commit/ff1a7e019f45ad00fc9aa3e0fcb08df5acc54a66

在js文件的开头写着:

 define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {  

此行抛出错误:ReferenceError: define is not defined

我不熟悉这种“定义”语法,所以不确定出了什么问题。我试图指向我的 jquery 移动文件 (jquery.mobile-1.4.2.min.js) 的路径,但错误仍然存​​在。

那么定义是做什么的,为什么会抛出错误?

【问题讨论】:

    标签: javascript jquery jquery-mobile cordova


    【解决方案1】:

    在调用 Jquery 移动 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("ios") != -1)
                           {
                             $.mobile.defaultPageTransition = 'none';
                             $.mobile.defaultDialogTransition = 'none';
                           }
                        });
                        </script>
                        <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script>
    

    【讨论】:

    • 您好,transitions.js 文件仍然会抛出错误,但是使用后退按钮时有时还会出现闪烁的 s,但总体上可能会少一些跳动。后退按钮的建议?
    • 确认条件是否触发?
    • 嗯,它似乎没有触发,我在 if 语句中放了一个警报并在我的手机上运行它,但没有提示任何警报。
    • 不,也不触发
    • 抱歉,mobileinit 确实触发了,我的错。
    猜你喜欢
    • 2014-05-07
    • 2021-03-18
    • 1970-01-01
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-15
    • 1970-01-01
    相关资源
    最近更新 更多