Created
December 6, 2012 17:27
-
-
Save ludder/4226305 to your computer and use it in GitHub Desktop.
iOS hacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! A fix for the iOS orientationchange zoom bug. | |
Script by @scottjehl, rebound by @wilto. | |
MIT / GPLv2 License. | |
Source: https://github.com/scottjehl/iOS-Orientationchange-Fix | |
Explanation: http://adactio.com/journal/4470/ | |
*/ | |
// No code, check source above | |
/** | |
* A nasty bug in iOS prevents clicking on labels | |
* See also: http://v4.thewatchmakerproject.com/blog/how-to-fix-the-broken-ipad-form-label-click-issue/ | |
*/ | |
function addSafariLabelClick() { | |
if (navigator.userAgent.match(/iPhone/i) || | |
navigator.userAgent.match(/iPod/i) || | |
navigator.userAgent.match(/iPad/i)) { | |
// Just an empty function should be enough to deal with this issue in iOS 5+ | |
var labels = document.querySelectorAll('label'); | |
for (var i=0; i<labels.length; i++) { | |
labels[i].addEventListener( 'click', function(){}, false); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Applying
cursor:pointer
to thelabel
should have the same effect.