简体   繁体   English

防止使用iscroll滚动到页面顶部?

[英]prevent scrolling to top of page with iscroll?

I use jqtouch and iscroll for my app. 我为我的应用程序使用jqtouch和iscroll。 I load all pages with ajax and when I go back from a ajax loaded page to the index (menulist) page, that page scrolls to the top. 我用ajax加载所有页面,当我从ajax加载的页面返回索引(菜单)页面时,该页面滚动到顶部。 How can I prevent this? 我该如何预防? Thanks. 谢谢。

您是否尝试将选项checkDOMChanges设置为false?

I believe there is a boolean option called topOnDOMChanges 我相信有一个名为topOnDOMChanges的布尔选项

var scroll = new iScroll(contentid, {
                          desktopCompatibility: true,
                          bounce: true,
                          momentum: true,
                          checkDOMChanges: false,
                          topOnDOMChanges: false
                        });

From the Beedesk fork of JQTouch https://github.com/beedesk/jQTouch/blob/master/demos/main/index.html 从JQTouch的Beedesk分支https://github.com/beedesk/jQTouch/blob/master/demos/main/index.html

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

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