diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-06 21:11:08 +0100 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-06 21:11:08 +0100 |
commit | 45fcf19c4d2c8096fbafe71de67e2c5279d4d70d (patch) | |
tree | d832464f8e3d799c46eabf84e28247865025d87b | |
parent | 3fceded114eacc1576a64e7ebfbab6d4a891eb61 (diff) | |
download | impress.js-45fcf19c4d2c8096fbafe71de67e2c5279d4d70d.tar.gz |
using history.pushState instead of location change in courtesy of @medikoo
-rw-r--r-- | js/impress.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/js/impress.js b/js/impress.js index ca16de0..7395cd9 100644 --- a/js/impress.js +++ b/js/impress.js @@ -97,7 +97,7 @@ var getElementFromUrl = function () { // get id from url # by removing `#` or `#/` from the beginning, - // so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work + // so both `#slide-id` and "legacy" `#/slide-id` will work return byId( window.location.hash.replace(/^#\/?/,"") ); }; @@ -252,15 +252,13 @@ root.className = "step-" + el.id; - // `#/step-id` is used instead of `#step-id` to prevent default browser - // scrolling to element in hash - // - // and it has to be set after animation finishes, because in chrome it + // Setting fragment URL with `history.pushState` + // and it has to be set after animation finishes, because in Chrome it // causes transtion being laggy // BUG: http://code.google.com/p/chromium/issues/detail?id=62820 window.clearTimeout( hashTimeout ); hashTimeout = window.setTimeout(function () { - window.location.hash = "#/" + el.id; + history.pushState({}, '', '#' + el.id); }, 1000); var target = { |