Stop browser from scrolling out the app

This commit is contained in:
Remy Sharp 2012-06-17 09:47:24 +01:00
parent d26e262d0f
commit f476ef5342

View File

@ -66,4 +66,12 @@ if (/gist\/\d+/.test(window.location.pathname) && (!sessionStorage.getItem('java
}
}
// prevent the app from accidently getting scrolled out of view
document.body.onscroll = window.onscroll = function () {
if (document.body.scrollTop !== 0) {
window.scrollTo(0,0);
}
return false;
};
window.CodeMirror = CodeMirror; // fix to allow code mirror to break naturally