0

I have a page in jquery mobile, I want to prevent the page from scrolling but allow the user to scroll an element on the page that has overflow set to scroll. Should be noted that the reason I need this is because the page length will vary slightly, beyond 100% on some different devices.

<div data-role="page" id="noscroll>
    <div data-role="content">
         <div class="scrollable">
         </div>
    </div>
</div>

I've tried something like this but obviously this prevents the scrollable element from responding to the touchmove event.

$('#noscroll').on('touchmove', function(){
      e.preventDefault();
      });
OliverJ90
  • 1,221
  • 1
  • 17
  • 38
  • **[This link](http://stackoverflow.com/questions/15132630/how-to-prevent-document-scrolling-but-allow-scrolling-inside-div-elements-on-web)** and **[this link](http://stackoverflow.com/questions/9280258/prevent-body-scrolling-but-allow-overlay-scrolling)** might be helpful – Guruprasad J Rao Apr 23 '15 at 12:17

1 Answers1

0

Try this type of approach :

$('*:not(.scrollable)').on('scroll touchmove', function(e){
    e.preventDefault();
});

not tested but should be a start to find the correct way to do what you want.

DylannCordel
  • 516
  • 5
  • 9