Skip to content

Instantly share code, notes, and snippets.

@jcubic
Created December 23, 2016 13:07
Show Gist options
  • Save jcubic/8504dfc220aaf378dc42ee9b44e381cf to your computer and use it in GitHub Desktop.
Save jcubic/8504dfc220aaf378dc42ee9b44e381cf to your computer and use it in GitHub Desktop.
Implementation of "Using CSS Selectors as Fragment Identifiers" Unofficial Draft
function jump() {
var match = location.hash.match(/^#css\((.*)\)$/);
if (match) {
window.scrollTo(0, document.querySelector(match[1]).offsetTop);
}
}
jump();
window.addEventListener("hashchange", jump, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment