Skip to content

Instantly share code, notes, and snippets.

@Takeno
Last active December 20, 2015 08:09
Show Gist options
  • Save Takeno/6098175 to your computer and use it in GitHub Desktop.
Save Takeno/6098175 to your computer and use it in GitHub Desktop.
Hide navigation bar on iphone. It will appear only with a double tap on header
$(document).on('touchmove',function(e){
e.preventDefault();
});
$('body').on('touchstart','.scrollable',function(e) {
if (e.currentTarget.scrollTop === 0)
e.currentTarget.scrollTop = 1;
else if (e.currentTarget.scrollHeight === e.currentTarget.scrollTop + e.currentTarget.offsetHeight)
e.currentTarget.scrollTop -= 1;
});
$('body').on('touchmove','.scrollable',function(e) {
e.stopPropagation();
});
$(window).load(function () {
$('body').scrollTop(0,0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment