Skip to content

Instantly share code, notes, and snippets.

@foliomob
foliomob / url-scroll-fix
Created March 8, 2012 11:44
iOS webkit hide url bar and native scrolling
<!DOCTYPE html>
<html>
<!-- NOTES
I've been looking for a simple way to persistently show a header and hide the url bar (beyond just position:fixed; top:0, which is only persistent until you scroll back home). I think this is it. Maybe there are better ways, but this sure is simple! One thing that's missing though is to have the URL bar disappear again once you scroll anywhere else on the page.
It's based on the awesome work of mattsahr, bjrn, and bradbirdsall here: https://github.com/joelambert/ScrollFix/issues/2. It's not the problem they were trying to fix, but it's an awesome collateral benefit. To get what I was looking for, I tore a lot of their stuff out, and made the simplest starting file I could.
I tested it on an iPhone running iOS 5.1 and it seems to do what I was looking for.