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

Function scroll

lib/test/angular/1.4.3/angular.js:4713–4728  ·  view source on GitHub ↗
(hash)

Source from the content-addressed store, hash-verified

4711 }
4712
4713 function scroll(hash) {
4714 hash = isString(hash) ? hash : $location.hash();
4715 var elm;
4716
4717 // empty hash, scroll to the top of the page
4718 if (!hash) scrollTo(null);
4719
4720 // element with given id
4721 else if ((elm = document.getElementById(hash))) scrollTo(elm);
4722
4723 // first anchor with given name :-D
4724 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
4725
4726 // no element and hash == 'top', scroll to the top of the page
4727 else if (hash === 'top') scrollTo(null);
4728 }
4729
4730 // does not scroll when user clicks on anchor link that is currently on
4731 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 3

isStringFunction · 0.70
scrollToFunction · 0.70
getFirstAnchorFunction · 0.70

Tested by

no test coverage detected