2

I have a problem that's driving me nuts - I've found one other question about it, but no conrete solution. I'm using the following to hide the URL bar on my mobile site:

window.addEventListener("load",function() {
    setTimeout(function(){
        window.scrollTo(0, 0);
    }, 0);
});

This works fine, but there is just a very large gap between when the content jumps to the top, and when the actual URL bar slides up. Has anyone else run into this? Here's the other question: Jquery mobile - Delay auto hiding address bar

This question points to iOS6's new 'Reader' button as the culprit; is there any forseeable way around it? Hiding Address Bar in Mobile Safari With Reader Button Visible

FYI, unlike the similar question I posted, I'm not using jQuery mobile, just plain old jQuery 1.8.

Community
  • 1
  • 1
collin
  • 240
  • 1
  • 3
  • 12

2 Answers2

1

It might be that you have images or you are using scripts form CDNS that take a while to load, you might try loading the page in a browser and checking with the timeline tab to see if anything is taking a long time to load.

Another idea, the issue might be the the size of your screen is not initially long enough to allow for the scroll? So its possible that it can't scroll till you run additional scripts.

nycynik
  • 7,371
  • 8
  • 62
  • 87
  • 1
    Thanks! This problem was driving me nuts. I couldn't figure out why there was a delay in the address bar loading and your answer made me test the JS in a barebones HTML file with no special styles or other scripts loading. The address bar disappeared almost immediately. Now I just wonder what magic sites like Medium.com are doing to get around the loading issue... – Raam Dev Oct 03 '13 at 22:40
1

So it is most definitely the 'reader' button that is causing the delay - I was using article tags to display my content; switching to a standard div remedies the problem. FWIW, the delay goes from around 5 seconds with the reader button enabled, to under 1 second without it on iOS 6.

collin
  • 240
  • 1
  • 3
  • 12