MCPcopy Index your code
hub / github.com/angular-ui/ui-router / scroll

Function scroll

test/angular/1.6/angular.js:5387–5403  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

5385 }
5386
5387 function scroll(hash) {
5388 // Allow numeric hashes
5389 hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash();
5390 var elm;
5391
5392 // empty hash, scroll to the top of the page
5393 if (!hash) scrollTo(null);
5394
5395 // element with given id
5396 else if ((elm = document.getElementById(hash))) scrollTo(elm);
5397
5398 // first anchor with given name :-D
5399 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
5400
5401 // no element and hash === 'top', scroll to the top of the page
5402 else if (hash === 'top') scrollTo(null);
5403 }
5404
5405 // does not scroll when user clicks on anchor link that is currently on
5406 // (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