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

Function scroll

test/angular/1.3/angular.js:4478–4492  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4476 }
4477
4478 function scroll() {
4479 var hash = $location.hash(), elm;
4480
4481 // empty hash, scroll to the top of the page
4482 if (!hash) scrollTo(null);
4483
4484 // element with given id
4485 else if ((elm = document.getElementById(hash))) scrollTo(elm);
4486
4487 // first anchor with given name :-D
4488 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
4489
4490 // no element and hash == 'top', scroll to the top of the page
4491 else if (hash === 'top') scrollTo(null);
4492 }
4493
4494 // does not scroll when user clicks on anchor link that is currently on
4495 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 2

scrollToFunction · 0.70
getFirstAnchorFunction · 0.70

Tested by

no test coverage detected