I am unable to hide the address bar on page load - iPhone.
I have googled and tried few solutions.
function hideAddressBar() { //first one
if (!window.location.hash) {
if (document.height < window.outerHeight) {
document.body.style.height = (window.outerHeight + 50) + 'px';
}
setTimeout(function () { window.scrollTo(0, 1); }, 50);
}
}
window.addEventListener("load", function () { if (!window.pageYOffset) { hideAddressBar(); } });
function page_Load() { //second one
$('body').scrollTop(1);
}
jQuery(function($) { //third using jquery
$('html,body').scrollTop(0)
};
I have debugged and seen the pageXOffset and pageYOffset. Both of them are 0 always. I don't understand what's the problem. But on orientation change address bar is hidden.
I know this question has been posted previously. But none of the solutions worked for me. If anybody knows what's the exact problem, please help me.
Aucun commentaire:
Enregistrer un commentaire