MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / scroll

Function scroll

code/songhop/www/lib/angular/angular.js:4428–4442  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4426 }
4427
4428 function scroll() {
4429 var hash = $location.hash(), elm;
4430
4431 // empty hash, scroll to the top of the page
4432 if (!hash) scrollTo(null);
4433
4434 // element with given id
4435 else if ((elm = document.getElementById(hash))) scrollTo(elm);
4436
4437 // first anchor with given name :-D
4438 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
4439
4440 // no element and hash == 'top', scroll to the top of the page
4441 else if (hash === 'top') scrollTo(null);
4442 }
4443
4444 // does not scroll when user clicks on anchor link that is currently on
4445 // (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