MCPcopy Create free account
hub / github.com/apache/cloudstack / scroll

Function scroll

tools/ngui/static/js/lib/angular.js:2966–2980  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2964 }
2965
2966 function scroll() {
2967 var hash = $location.hash(), elm;
2968
2969 // empty hash, scroll to the top of the page
2970 if (!hash) $window.scrollTo(0, 0);
2971
2972 // element with given id
2973 else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
2974
2975 // first anchor with given name :-D
2976 else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
2977
2978 // no element and hash == 'top', scroll to the top of the page
2979 else if (hash === 'top') $window.scrollTo(0, 0);
2980 }
2981
2982 // does not scroll when user clicks on anchor link that is currently on
2983 // (no url change, no $location.hash() change), browser native does scroll

Callers

nothing calls this directly

Calls 2

getFirstAnchorFunction · 0.85
hashMethod · 0.80

Tested by

no test coverage detected