Skip to content

Instantly share code, notes, and snippets.

@erikflowers
Created January 26, 2013 05:13
Show Gist options
  • Save erikflowers/4640337 to your computer and use it in GitHub Desktop.
Save erikflowers/4640337 to your computer and use it in GitHub Desktop.
A snippet of coffeescript I am using to disable any sticky header/nav when on a mobile device. Viewport size was not as reliable when dealing with landscape tablets and desktop browsers having the same viewport, but one needing sticky and another not.
$(document).ready detectMobileDisable = ->
ua = navigator.userAgent.toLowerCase()
if (ua.indexOf("android") > -1) or (ua.indexOf("iphone") > -1) or (ua.indexOf("ipod") > -1) or (ua.indexOf("ipad") > -1)
$(document).ready ->
$("#element_to_unstick").addClass "noStick"
$("#element_that_needs_buffer_offset").addClass "noBuffer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment