fix race condition in fragment jumper
authorDan Allen <dan@opendevise.com>
Mon, 16 Apr 2018 04:19:13 +0000 (22:19 -0600)
committerDan Allen <dan@opendevise.com>
Mon, 16 Apr 2018 04:22:05 +0000 (22:22 -0600)
- sometimes the built-in jump wins out; jump again after delay to be sure

src/js/02-fragment-jumper.js

index e324227..186a193 100644 (file)
@@ -24,6 +24,7 @@
     var hash, target
     if ((hash = window.location.hash) && (target = document.getElementById(hash.slice(1)))) {
       jumpToAnchor.bind(target)()
+      setTimeout(jumpToAnchor.bind(target), 0)
     }
     window.removeEventListener('load', jumpOnLoad)
   })