Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created September 7, 2010 02:17
Show Gist options
  • Save typeoneerror/567769 to your computer and use it in GitHub Desktop.
Save typeoneerror/567769 to your computer and use it in GitHub Desktop.
$.isMobileSafari = function(){return navigator.userAgent.match(/AppleWebKit\/(.*)Mobile\//);}
if ($.isMobileSafari())
{
$("#facebook").css("position", "absolute");
$.bindToBottom = function()
{
$("#facebook").css("top", (window.pageYOffset + window.innerHeight - 30) + 'px');
}
// sadly this does nothing as the pageYOffset is set
// after dom loads via objective-c "stringByEvaluatingJavaScriptFromString"
// or something. window.pageYOffset reports 0 on reload.
$.bindToBottom();
// onscroll is fired when scrolling ends. it stays stuck and
// then jumps. looks poor, but that's the best we can get.
// also try touchmove.
$(window).bind("scroll", function()
{
$.bindToBottom();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment