我正在使用 IBM 的 worklight 框架开发一个应用程序,其中我使用 jquery 移动库进行编码。
不幸的是,当我使用$.mobile.silentScroll
滚动,它没有效果,它不起作用。
有人遇到过这个问题吗?在其他工作中,如何在worklight中滚动页面?
我不认为你可以用 jQuery Mobile 来做到这一点silentScroll
,因为它基本上使用 window.scrollTo,这允许仅在当前视口(您当前在屏幕上看到的内容)内滚动。
相反,我建议使用iScroll http://iscrolljs.com/的各种API方法:scrollTo
, ScrollToElement
or Snap
, etc.
我在 Android 中测试了以下内容并且有效。
您当然需要根据您的应用程序进行调整......
公共\js\main.js:
var myScroll;
function wlCommonInit(){
myScroll = new IScroll('#wrapper');
}
常见\index.html:
<body style="display: none;">
<div id="wrapper">
<div data-role="page" id="page">
<div data-role="content" id="content" style="padding: 15px">
<div id="firstDiv">
<input type="button" value="scroll to the other div" onclick="myScroll.scrollToElement('#secondDiv', '0s');"/>
</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="secondDiv">
hello
</div>
</div>
</div>
</div>
...
...
</body>
0s
表示不会有滚动效果;它基本上会“跳”到所需的位置。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)