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

Function scroll

lib/test/angular/1.6.7/angular.js:5367–5383  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

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