MCPcopy Index your code
hub / github.com/devote/HTML5-History-API / scrollToAnchorId

Function scrollToAnchorId

history.js:990–997  ·  view source on GitHub ↗

* Scroll page to current anchor in url-hash * * @param hash

(hash)

Source from the content-addressed store, hash-verified

988 * @param hash
989 */
990 function scrollToAnchorId(hash) {
991 var target = document.getElementById(hash = (hash || '').replace(/^#/, ''));
992 if (target && target.id === hash && target.nodeName === "A") {
993 var rect = target.getBoundingClientRect();
994 global.scrollTo((documentElement.scrollLeft || 0), rect.top + (documentElement.scrollTop || 0)
995 - (documentElement.clientTop || 0));
996 }
997 }
998
999 /**
1000 * Library initialization

Callers 2

onLoadFunction · 0.70
onAnchorClickFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected