2011-09-02 17 views
0

這只是一個普遍的問題。要使用iScroll與我的移動應用程序,每一個滾動區域,必須啓動新的卷軸:iScroll jquery移動插件。更好地啓動這個50次,或者甚至把聽衆轉回來,甚至聽衆又回來了?

http://cubiq.org/iscroll-4

"iScroll needs to be initialized for each scrolling area you need. 
There’s no limit to the number of iScrolls you can have on any single page, 
if not that imposed by the device memory/cpu. The type and length of the contents 
influence the number of iScrolls you can use simultaneously." 

但我需要滾動功能50多頁。要使用iScroller,我需要禁用與對touchmove事件:

 document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); 

我可以減少滾動條的量只有4,如果我可以鍛鍊如何能在某些網頁上的TouchMove事件(莫名其妙!)。

我想知道的是,我會更好地啓用和禁用touchmove事件,或者只是啓動50個滾動條會更好嗎?

謝謝先進。

回答

1

您可以使用pagecreate事件來決定要啓用/禁用哪些頁面touchmove。 要做到這一點,添加這個每頁:

$('#myPageName').live('pagecreate',function(event){ 
    console.log("about to create myPageName"); 
}); 

或者,你可以捕獲所有頁面show/hide功能,並制定出一些邏輯對這些頁面存在。

閱讀jQM events documentation瞭解更多信息。