0

I am building a website for the Nintendo 3DS and have been trying to figure out a way to disable scrolling in the browser. I have the meta tag set to: <meta name="viewport" content="width=device-width" /> which is working, and also have this to position the page properly:

$(window).load(function() {
    window.scrollTo(40, 240);
})

This is necessary so that the top screen is filled with content since the browser loads in the bottom screen. The next part would be disabling scrolling so that the user does not re-position the browser outside of the content area since it is possible to scroll off the page. I have tried these with no luck:

  • http://stackoverflow.com/a/3656618/1363726
  • http://stackoverflow.com/a/4770059/1363726
  • http://ajax911.com/disable-window-scroll-jquery/

I feel like disabling scrolling should be possible since window.scrollTo() works. Any thoughts or suggestions on what else I might try would be greatly appreciated.

Thanks

eivers88
  • 5,821
  • 1
  • 31
  • 34
  • You could intercept the scroll event and set the scroll there, but I'm not sure if you can disable scrolling completely. Why not set the document's size to be exactly equal to the size of the screen - thus no scrolling? – Chris Carew Jun 26 '12 at 23:47
  • I have set the document to the size of the two screens combined height, and top screens width. However, the 3DS browser allows the user to scroll completely off the document into blank space. I also have tried intercepting the scroll event, but the scroll event only fires sometimes, and only on vertical movement. Also, after the initial `window.scrollTo()` trying to use that same function no longer works. – eivers88 Jun 26 '12 at 23:54
  • Maybe you could have a position fixed div, which exists at -240, -40, and is the exact size of the window. That way their scrolls wouldn't matter, and the div would always be visible "perfectly" positioned. – Chris Carew Jun 27 '12 at 18:59
  • That won't work, you can literally scroll off of the html document into blank space, it's just the way the browser was built. – eivers88 Jun 27 '12 at 20:07
  • Shouldn't `position: fixed;` remove that problem? – Chris Carew Jun 27 '12 at 23:16
  • When I say "blank space" I'm referring to outside of the actual html document, position fixed works fine until you scroll outside of the document. I think this exists because of the dual screens at different sizes. – eivers88 Jun 28 '12 at 04:35

0 Answers0