From f476ef5342cbe2bd2dc4457fda49ed8c19cc3ee9 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Sun, 17 Jun 2012 09:47:24 +0100 Subject: [PATCH] Stop browser from scrolling out the app --- public/js/chrome/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/js/chrome/app.js b/public/js/chrome/app.js index 3ddfec18..8ce3753e 100644 --- a/public/js/chrome/app.js +++ b/public/js/chrome/app.js @@ -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