简体   繁体   English

jQuery Mobile单页和多页网站上没有过渡和其他问题

[英]No transitions and other issues on jQuery Mobile single and multi-page website

I'm really struggling to load a multi-page template with Phonegap and using jQuery. 我真的很难用Phonegap和jQuery加载多页模板。

Here I have two pages ( home and 1 ) but when I load the page it just displays the second "page" div ( 1 , not home ) and no link changes the page. 在这里,我有两个页面( home1 ),但是当我加载页面时,它仅显示第二个“页面” div( 1 ,不是home ),并且没有链接更改页面。

With the pages as two separate .html files I could not get the transitions to work - and here I'm a step even further behind, as I can't even change pages! 将页面作为两个单独的.html文件,我无法进行过渡-在这里,我甚至还差了一步,因为我什至无法更改页面!

Code: 码:

<script type="text/javascript" src="cordova-2.3.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/iscroll.js"></script>    
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>

<body>
    <div data-role="page" id="home">
        <div id="header"><h1>Title</h1></div>
        <div id="wrapper">
            <div id="scroller">
                <div id="content">
                    <a href="#1" data-transition="slide">Link to Page 2</a>
                </div>
            </div>
        </div>
        <div id="footer"><a href="about.html"><div class="footer_abt"></div></a></div>
    </div>


    <div data-role="page" id="1">
        <div id="header"><h1>Tummy Time</h1></div>
        <div id="wrapper">
            <div id="scroller">
                <div id="content">
                    <!-- Content Here -->
                </div>
            </div>
        </div>
        <div id="footer">
            <a href="#home"><div class="footer_home"></div></a>
        </div>
    </div>

</body>

jQuery Mobile, to the best of my knowledge, is not meant to work for multiple static pages. 就我所知,jQuery Mobile并不是要用于多个静态页面。 I mean, I guess you could do that, but I doubt any of the transitions would work. 我的意思是,我想您可以做到,但是我怀疑任何过渡都行得通。 Further, it definitely won't work if you compile via PhoneGap. 此外,如果通过PhoneGap进行编译,则绝对无法使用。

If you want multiple views, I would suggest switching to an MVC js framework like Backbone.js or Sencha Touch. 如果您想要多个视图,我建议您切换到MVC js框架,例如Backbone.js或Sencha Touch。

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

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