{"id":968,"date":"2012-05-04T12:05:53","date_gmt":"2012-05-04T19:05:53","guid":{"rendered":"http:\/\/zsprawl.com\/iOS\/?p=968"},"modified":"2012-05-05T02:19:48","modified_gmt":"2012-05-05T09:19:48","slug":"completely-disabling-zoom-in-jquery-mobile-1-1-0","status":"publish","type":"post","link":"http:\/\/zsprawl.com\/iOS\/2012\/05\/completely-disabling-zoom-in-jquery-mobile-1-1-0\/","title":{"rendered":"Completely Disabling Zoom in jQuery Mobile"},"content":{"rendered":"<p>As every iOS programmer knows, you can easily disable zoom in your webapp with the following viewport meta tag:<\/p>\n<p>[code]<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scaleable=no\">[\/code]<\/p>\n<p>However, while coding my most recent App, <a href=\"http:\/\/zsprawl.com\/iOS\/zapps\/britelite\/\">BriteLite<\/a>, I noticed that sometimes when the user would be tapping all around on the screen, that a doubletap would trigger somehow and zoom in the App. Since the App has zooming disabled in the meta tag, it wasn&#8217;t simple to unzoom the window when this bug would trigger. After a lot of messing around, the best I could tell is that when a user double tapped on the 1px border of a div, it would trigger this zoom. Since it takes precision to hit a 1px border twice, it wouldn&#8217;t trigger often.<\/p>\n<p>Fixing it was rather simple, once I figured out how to override zooming capabilities in jQuery Mobile 1.1.0. All I had to do was add the following:<\/p>\n<p>[code]$(document).bind( &#8220;mobileinit&#8221;, function(event) {<br \/>\n\t$.extend($.mobile.zoom, {locked:true,enabled:false});<br \/>\n});[\/code]<\/p>\n<p>And of course, make sure you call the mobileinit before you load jQuery Mobile. Has anyone else had this issue? I couldn&#8217;t find it documented anywhere.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As every iOS programmer knows, you can easily disable zoom in your webapp with the following viewport meta tag: However, while coding my most recent App, BriteLite, I noticed that sometimes when the user would be tapping all around on the screen, that a doubletap would trigger somehow and zoom in the App. Since the <a href=\"http:\/\/zsprawl.com\/iOS\/2012\/05\/completely-disabling-zoom-in-jquery-mobile-1-1-0\/#more-'\" class=\"more-link\"><br \/>more \u00bb<\/a><\/p>\n","protected":false},"author":318,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,61,25],"tags":[120,49],"class_list":["post-968","post","type-post","status-publish","format-standard","hentry","category-blog","category-britelite","category-jquery-mobile","tag-jquery-mobile","tag-webapp"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/968"}],"collection":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/users\/318"}],"replies":[{"embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/comments?post=968"}],"version-history":[{"count":4,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/968\/revisions"}],"predecessor-version":[{"id":972,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/posts\/968\/revisions\/972"}],"wp:attachment":[{"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/media?parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/categories?post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zsprawl.com\/iOS\/wp-json\/wp\/v2\/tags?post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}