简体   繁体   English

使用phonegap和jQuery mobile初始化iscroll

[英]initializing iscroll with phonegap and jQuery mobile

I have built a project using phonegap and jquery mobile, and have iscroll working perfectly on the first page. 我已经使用phonegap和jquery mobile构建了一个项目,并且iscroll在第一页上可以正常工作。 However on my second page iscroll isn't running. 但是在我的第二页上,iscroll没有运行。 Can someone tell me how you initialize a jquery script on the page in JQM? 有人可以告诉我如何在JQM页面上初始化jquery脚本吗? I am new to both platforms and think it may be a simple mistake! 我是这两个平台的新手,并且认为这可能是一个简单的错误! Thanks 谢谢

I never used phonegap, but im building a JQM-webapp as well, so i hope this works for you. 我从未使用过phonegap,但是我也正在构建JQM-webapp,所以我希望这对您有用。

iScroll seems to cause several problems trying to implement it in JQM. 尝试在JQM中实施iScroll似乎会导致一些问题。 This is why they came up with jquery.mobile.iscrollview which bascically adapts the iScroll javascript to the jQuery Mobile environment. 这就是为什么他们提出了jquery.mobile.iscrollview的原因 ,它使iScroll javascript基本适应了jQuery Mobile环境。

Just include the script and add data-iscroll="" to your div. 只需包含脚本并将data-iscroll=""到您的div中即可。 And include all of your scripts in the given order. 并按给定顺序包含所有脚本。

checkDOMChanges: set to false to prevent auto refresh on DOM changes. checkDOMChanges:设置为false以防止在DOM更改时自动刷新。 If you switch off this feature you have to call iScroll.refresh() function programmatically every time the DOM gets modified. 如果关闭此功能,则必须在每次修改DOM时以编程方式调用iScroll.refresh()函数。 If your code makes many subsequent DOM modifications it is suggested to set checkDOMChanges to false and to refresh the iScroll only once (ie: when all changes have been done). 如果您的代码进行了许多后续的DOM修改,建议将checkDOMChanges设置为false并仅刷新一次iScroll(即:完成所有更改后)。 Default true. 默认为true。

see more on there page: http://cubiq.org/iscroll 在该页面上查看更多信息: http : //cubiq.org/iscroll

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

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