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

Function scroll

test/angular/1.2/angular.js:4080–4094  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4078 }
4079
4080 function scroll() {
4081 var hash = $location.hash(), elm;
4082
4083 // empty hash, scroll to the top of the page
4084 if (!hash) $window.scrollTo(0, 0);
4085
4086 // element with given id
4087 else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
4088
4089 // first anchor with given name :-D
4090 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
4091
4092 // no element and hash == 'top', scroll to the top of the page
4093 else if (hash === 'top') $window.scrollTo(0, 0);
4094 }
4095
4096 // does not scroll when user clicks on anchor link that is currently on
4097 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 1

getFirstAnchorFunction · 0.70

Tested by

no test coverage detected