Sundar Nivash
Sundar Nivash

Reputation: 306

How to make a scroll customization for mobile application?

Hi I am developing cross platform mobile application using cordova. In iOS platform my application scroll over when page is moved up and down. For that I have a code to stop scrolling and make my application like native application using the following script.

  $('body').on('touchstart','.scrollable',function(e) {
    if (e.currentTarget.scrollTop === 0) {
      e.currentTarget.scrollTop = 1;
    } else if (e.currentTarget.scrollHeight
              === e.currentTarget.scrollTop
                  + e.currentTarget.offsetHeight) {
      e.currentTarget.scrollTop -= 1;
    }
  });
  $('body').on('touchmove','.scrollable',function(e) {
    e.stopPropagation();
  });

This works fine. My application do not scroll top and bottom. But in my code I am having div element with style attribute overflow:auto; this scrolls when the content exceed the div size but after using this code my div scroll is not working. How to make this work. This is my css code for div element,

.tablediv {
    position: absolute;
    left: 0px;
    top: 136px;
    width: 414px;
    height: 375px;
     overflow: auto;
}

I need to scroll the elements that are necessary. Can someone help me? Thanks in advance.

Upvotes: 0

Views: 65

Answers (1)

Joerg
Joerg

Reputation: 3101

You don't have to write JS for preventing overscroll, there is a setting in your config.xml for that:

<preference name="DisallowOverscroll" value="true" />

Upvotes: 2

Related Questions