Skip to content

Instantly share code, notes, and snippets.

@naotone
Last active December 16, 2015 13:59
Show Gist options
  • Save naotone/5445179 to your computer and use it in GitHub Desktop.
Save naotone/5445179 to your computer and use it in GitHub Desktop.
Hide position: fixed; elements after pinch zoom.
//Copyright 2013 NAOTONE
//Please use under MIT license.
jQuery(window).resize(function() {
iOSClearFixed();
});
jQuery('html').on("touchend", touchHandler);
touchHandler = function(event) {
return iOSClearFixed;
};
iOSClearFixed = function() {
var zoom;
zoom = document.documentElement.clientWidth - window.innerWidth;
if (zoom >= 80) {
return jQuery(".fixed").css("z-index", -1);
} else{
return jQuery(".fixed").css("z-index", 10);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment