MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / scroll

Function scroll

OpenReservation/wwwroot/Scripts/angular.js:4885–4897  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

4883 }
4884
4885 function scroll(hash) {
4886 hash = isString(hash) ? hash : $location.hash();
4887 var elm;
4888
4889 // empty hash, scroll to the top of the page
4890 if (!hash) scrollTo(null);
4891 // element with given id
4892 else if ((elm = document.getElementById(hash))) scrollTo(elm);
4893 // first anchor with given name :-D
4894 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
4895 // no element and hash == 'top', scroll to the top of the page
4896 else if (hash === 'top') scrollTo(null);
4897 }
4898
4899 // does not scroll when user clicks on anchor link that is currently on
4900 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 3

isStringFunction · 0.85
scrollToFunction · 0.85
getFirstAnchorFunction · 0.85

Tested by

no test coverage detected