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

Function scroll

lib/test/angular/1.7.0/angular.js:5363–5379  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

5361 }
5362
5363 function scroll(hash) {
5364 // Allow numeric hashes
5365 hash = isString(hash) ? hash : isNumber(hash) ? hash.toString() : $location.hash();
5366 var elm;
5367
5368 // empty hash, scroll to the top of the page
5369 if (!hash) scrollTo(null);
5370
5371 // element with given id
5372 else if ((elm = document.getElementById(hash))) scrollTo(elm);
5373
5374 // first anchor with given name :-D
5375 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
5376
5377 // no element and hash === 'top', scroll to the top of the page
5378 else if (hash === 'top') scrollTo(null);
5379 }
5380
5381 // does not scroll when user clicks on anchor link that is currently on
5382 // (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