preventing all scroll events was not such an impressive idea after all...

This commit is contained in:
Bartek Szopka
2012-01-04 00:04:23 +01:00
parent 88cb10dbd1
commit 8953f37397

View File

@@ -190,6 +190,16 @@
return false; 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; var step = el.stepData;
if ( $(".step.active", impress) ) { if ( $(".step.active", impress) ) {
@@ -296,17 +306,6 @@
select( getElementFromUrl() ); select( getElementFromUrl() );
}, false); }, 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 // START
// by selecting step defined in url or first step of the presentation // by selecting step defined in url or first step of the presentation
select(getElementFromUrl() || steps[0]); select(getElementFromUrl() || steps[0]);