1

在页面之间切换时我遇到了性能问题。我去了各种论坛并添加了诸如 faskclick 之类的内容。

第一次,当我切换到不同的页面时,大约需要 3-4 秒,但从第二次开始它很快,例如 1-1.5 秒。现在,有时,单击不起作用。在 5 次点击中,只有 2-3 次点击有效。我正在努力弄清楚出了什么问题?

如果您能帮助我找出 click 不起作用的原因以及在使用 jquery mobile 时如何提高性能,那将非常有帮助。以下是我的代码片段

<html>
<!-- head -->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0" />

<title>Project</title>

<link rel="stylesheet" href="StyleSheet/jquery.mobile-1.3.0.css" />

<script src="StyleSheet/jquery-1.8.2.min.js"></script>
<script src="StyleSheet/jquery.mobile-1.3.0.js"></script>

<script src="StyleSheet/fastclick.js"></script>

<script type="application/javascript">

                $.mobile.defaultPageTransition = 'none';
                $.mobile.transitionFallbacks.slideout = 'none';

            window.addEventListener('load', function() {
                new FastClick(document.body);
            }, false);

            $( document ).bind( "mobileinit", function() {
                 $.mobile.buttonMarkup.hoverDelay = 500
            });

       </script>

</head>

<body>
    <div id="container">
        <div data-role="page" id="HomePage" class="jqm-demos">
            <div class="ui-body ui-body-b">
                <a href="#SecondPage">CLick Me to go second page</a>
            </div>
        </div>
        <div data-role="page" id="SecondPage" class="jqm-demos">
            <div class="ui-body ui-body-b">
                <br> <a href="#HomePage">CLick Me to go first page</a>
                <div id="JQM" data-theme="b" data-content-theme="c"
                    data-role="collapsible" data-collapsed-icon="arrow-d"
                    data-expanded-icon="arrow-u">
                    <h3>
                        <span style="float: left;"> JQM is very slow </span> <a
                            href="#JQM_1" class="splitButtonClicked" data-rel="popup"> <span
                            style="float: right;"
                            class="ui-btn-up-b ui-btn-corner-all ui-icon ui-icon-arrow-r2"></span>
                        </a>
                    </h3>
                    <p>I sther any way so that page transition should happen just
                        like native applciation when using JQM ? Botton click also also
                        sometimes not responsive.</p>
                </div>
            </div>
            <!-- content -->

            <!-- footer -->
            <div data-role="footer" data-theme="b" data-tap-toggle="false"
                data-position="fixed">
                <!--class="ui-bar ui-bar-b"-->
                <a href="#" data-rel="back" data-role="button" data-icon="arrow-l"
                    data-iconpos="notext" class="ui-btn-left" data-theme="b">left</a>
                <center>
                    <a href="#HomePage" data-role="button" data-icon="home"
                        data-iconpos="notext" data-theme="b">Home</a>
                </center>
                <a href="#" data-role="button" data-icon="arrow-r"
                    data-iconpos="notext" class="ui-btn-right" data-theme="b">Right</a>
            </div>
            <!-- /footer -->
        </div>
    </div>
</body>
</html>
4

0 回答 0