문제

I want to make my mobile web page auto scroll down to hide the browser search bar at the top of the page. An example of this is the Facebook home page on mobile, it auto scrolls down as soon as it loads so you almost feel like you're in an app and not a browser. Problem is each operating system has a different size for their browser search bar. Is there a property I can call to get its size or to autoscroll past it?

도움이 되었습니까?

해결책

From Hide the Address Bar within Mobile Safari

window.addEventListener("load",function() {
  // Set a timeout...
  setTimeout(function(){
    // Hide the address bar!
    window.scrollTo(0, 1);
  }, 0);
});

Hope this helps

다른 팁

Here is the solution to make the auto scroll work in mobile browsers

$('#elemIdTOScroll')[0].scrollIntoView(true);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top