MCPcopy
hub / github.com/angular-ui/ui-grid / scroll

Function scroll

lib/test/angular/1.8.0/angular.js:5478–5494  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

5476 }
5477
5478 function scroll(hash) {
5479 // Allow numeric hashes
5480 hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash();
5481 var elm;
5482
5483 // empty hash, scroll to the top of the page
5484 if (!hash) scrollTo(null);
5485
5486 // element with given id
5487 else if ((elm = document.getElementById(hash))) scrollTo(elm);
5488
5489 // first anchor with given name :-D
5490 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
5491
5492 // no element and hash === 'top', scroll to the top of the page
5493 else if (hash === 'top') scrollTo(null);
5494 }
5495
5496 // does not scroll when user clicks on anchor link that is currently on
5497 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 4

isStringFunction · 0.70
isNumberFunction · 0.70
scrollToFunction · 0.70
getFirstAnchorFunction · 0.70

Tested by

no test coverage detected