diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-01-04 00:04:23 +0100 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-01-04 00:04:23 +0100 |
commit | 8953f37397cf89b3341401eea3d23de847471099 (patch) | |
tree | e9ea0d0b7a3211adefa9ef1d9d519c3020b93078 | |
parent | 88cb10dbd1c7c883757aee4d49cecfa530c08365 (diff) | |
download | impress.js-8953f37397cf89b3341401eea3d23de847471099.tar.gz |
preventing all scroll events was not such an impressive idea after all...
-rw-r--r-- | js/impress.js | 21 |
1 files 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]); |