Skip to content
Browse files

Removed jQuery dependency from preventZoom function.

  • Loading branch information...
1 parent f32156a commit 4d938dbe4bf5bb3ab461d5e3f13a706facfd43dd @hleinone committed Mar 21, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 js/helper.js
View
16 js/helper.js
@@ -282,9 +282,17 @@ MBP.enableActive = function () {
// Prevent iOS from zooming onfocus
// http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/
MBP.preventZoom = function () {
- $('input, select, textarea').bind('focus blur', function(event) {
- MBP.viewportmeta.content = 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1);
- });
+ var formFields = document.querySelectorAll('input, select, textarea');
+ var contentString = 'width=device-width,initial-scale=1,maximum-scale=';
+ var i = 0;
+ for(i = 0; i < formFields.length; i++) {
+ formFields[i].onfocus = function() {
+ MBP.viewportmeta.content = contentString + '1';
+ };
+ formFields[i].onblur = function() {
+ MBP.viewportmeta.content = contentString + '10';
+ };
+ }
};
-})(document);
+})(document);

0 comments on commit 4d938db

Please sign in to comment.
Something went wrong with that request. Please try again.