簡體   English   中英

jQuery Mobile + iscroll4 +動態頁面加載

[英]Jquery Mobile + iscroll4 + dynamic page load

我是StackOverflow的新手,這是我的第一個問題,所以如果我做錯了事,請原諒。

我的問題是如何使iScroll 4在頁面上的多個div上工作,該頁面是使用load()方法動態加載的。

因此,將其分解為更簡單的內容:

我有一個單獨的頁面,稱為page.html

<html>
      <body>

            <ul data-iscroll="scroller">
               ..lots of data..
            </ul>

            <ul data-iscroll="scroller">
               ..lots of data..
            </ul>

      </body>
</html>

然后在我的index.html頁面上,我具有所有庫的常規標頭標記,並且這樣加載就很好了(我知道它可以正常工作,因為當我在index.html頁面中實際擁有列表時-> iScroll可以正常工作。只是當列表為動態加載)

我的index.html的主體是

<body>

      <div data-role="page>
            <div data-role="header" data-position="fixed">
                  <h3>header</h3>
            </div>

            <div data-role="content" id="content">
                 <!-- always empty - data will be loaded here -->
            </div>

            <div data-role="footer" data-position="fixed">
                 <h3>footer</h3>
            </div>
      </div>

</body>

頁面被加載到內容中(由於我可以看到所有內容,因此也可以)

$("#content").load("page.html",function(){
    $("#content").trigger('create');
});

就像您也知道的那樣,我包含的庫是

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.js"></script>
<!-- jScroll -->
<script src="iscroll.js" type="text/javascript"></script>
<script src="jquery.mobile.iscrollview.js" type="text/javascript"></script>

當我使用Chrome檢查元素時,將顯示所有數據,並且一切都存在,但是2 <ul>不會像我期望的那樣單獨滾動。 有人知道我在做什么錯嗎?

PS。 我還在使用python -m SimpleHTTPServer 8013的簡單服務器上運行此代碼,並通過PhoneGap運行Ripple模擬器來測試屏幕分辨率,因為這將用於手機。

這可以幫助你理解和唯一的你的問題,我希望..如果你還不清楚,讓我知道我會進一步解釋你...... 我約iScroll簡短的解釋是這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM