You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
anchorScroll() forces Android address bar to show #1718
The code below found in $anchorScrollProvider forces the Android address bar to show. The scroll method is called every time angular changes views, which causes this issue. While iOS and other browsers allow 0 in the scrollTo method, Android allows only positive integers for the desired behavior (http://mobile.tutsplus.com/tutorials/mobile-web-apps/remove-address-bar/).
function scroll() {
var hash = $location.hash(), elm;
// empty hash, scroll to the top of the page
if (!hash) $window.scrollTo(0, 0);
// element with given id
else if ((elm = document.getElementById(hash))) elm.scrollIntoView();
// first anchor with given name :-D
else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView();
// no element and hash == 'top', scroll to the top of the page
else if (hash === 'top') $window.scrollTo(0, 0);
}
Our fix is to wrap window's scrollTo method and check if the device is an Android. If it is an android and the x, y arguments are 0, 0, we manually set the value to 0, 1.
window.aliasedScrollTo = window.scrollTo
window.scrollTo = (x, y, delay) ->
if Device.android() && x == 0 && y == 0
window.aliasedScrollTo(x, 1, delay)
else
window.aliasedScrollTo(x, y, delay)
Activity
btford commentedon Aug 24, 2013
As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.
Please try the newest versions of Angular (
1.0.8and1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.Thanks!