简体   繁体   English

appmobi无法正确滚动

[英]appmobi doesn't scroll correctly

I am having 2 issue with scrolling, and I can't seem to figure out the happy medium being new to appmobi development. 我在滚动时遇到2个问题,而且似乎无法找出快乐的媒介成为Appmobi开发的新手。 Currently I have this bit of code.. 目前,我有这段代码。

    var preventDefaultScroll = function(event) {
    event.preventDefault();
    window.scroll(0,0);
    return false;
    };

    document.addEventListener('touchmove', preventDefaultScroll, false);

commenting these lines out the app doesn't scroll at all, commenting them out the app still doesnt scroll fully but lets me drag the whole app down so I can see my home screen behind the app. 在应用程序中将这些行注释掉根本不会滚动,在应用程序中将它们注释掉仍然不能完全滚动,但是我可以将整个应用程序向下拖动,以便可以看到应用程序后面的主屏幕。 Anyone know a way to fix that? 有人知道解决此问题的方法吗?

That's not what is preventing you from "Scrolling". 这不是阻止您“滚动”的原因。 Look for the "touchmove" listener 寻找“ touchmove”监听器

You'll want to get some code to scroll just a particular HTML element. 您将需要一些代码来仅滚动特定的HTML元素。 Maybe take a look at how the jqMobi scrolling works (http://jqmobi.com). 也许看看jqMobi滚动的工作原理(http://jqmobi.com)。 For an example of it in action, open up this URL in an HTML5 compliant browser like Chrome or Mobile Safari. 有关实际操作的示例,请在兼容HTML5的浏览器(例如Chrome或Mobile Safari)中打开此URL。

http://www.jqmobi.com/testdrive/#webslider http://www.jqmobi.com/testdrive/#webslider

The following code worked for me for scrolling. 下面的代码对我来说很有用。

 var options = {

    verticalScroll:true, //vertical scrolling

    horizontalScroll:false, //horizontal scrolling

    scrollBars:true,  //display scrollbars

    vScrollCSS : "jqmScrollbar", //CSS class for veritcal scrollbar

    hScrollCSS : "jqmScrollbar" //CSS class for horizontal scrollbar

  }
   var scroller3 = $("#DivId").scroller(options);

You can set the scrolling="no" to the div you do not want to scroll. 您可以将scrolling =“ no”设置为您不想滚动的div。

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

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