Skip to content

Commit

Permalink
Removed jQuery dependency from preventZoom function.
Browse files Browse the repository at this point in the history
  • Loading branch information
hleinone committed Mar 21, 2012
1 parent f32156a commit 4d938db
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.