From 8953f37397cf89b3341401eea3d23de847471099 Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Wed, 4 Jan 2012 00:04:23 +0100 Subject: [PATCH] preventing all scroll events was not such an impressive idea after all... --- js/impress.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/js/impress.js b/js/impress.js index 0e474df..f680802 100644 --- a/js/impress.js +++ b/js/impress.js @@ -190,6 +190,16 @@ return false; } + // Sometimes it's possible to trigger focus on first link with some keyboard action. + // Browser in such a case tries to scroll the page to make this element visible + // (even that body overflow is set to hidden) and it breaks our careful positioning. + // + // So, as a lousy (and lazy) workaround we will make the page scroll back to the top + // whenever slide is selected + // + // If you are reading this and know any better way to handle it, I'll be glad to hear about it! + window.scrollTo(0, 0); + var step = el.stepData; if ( $(".step.active", impress) ) { @@ -296,17 +306,6 @@ select( getElementFromUrl() ); }, false); - // Sometimes it's possible to trigger focus on first link with some keyboard action. - // Browser in such a case tries to scroll the page to make this element visible - // (even that body overflow is set to hidden) and it breaks our careful positioning. - // - // So, as a lousy (and lazy) workaround any scroll event will make the page scroll back to the top. - // - // If you are reading this and know any better way to handle it, I'll be glad to hear about it! - window.addEventListener("scroll", function ( event ) { - window.scrollTo(0, 0); - }, false); - // START // by selecting step defined in url or first step of the presentation select(getElementFromUrl() || steps[0]);