Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

when touch overflow scrolling is supported and enabled, user scaling …

…can create serious usability issues where it's difficult to get zoomed back out. This disables user scaling when that overflow scrolling is enabled (currently only projected for ios5 support)
  • Loading branch information...
commit 47480d69f9f91c91d5b37df332c8605144ad626f 1 parent 1ad3eea
scottjehl authored
4 js/jquery.mobile.fixHeaderFooter.native.js
View
@@ -7,8 +7,12 @@
(function( $, undefined ) {
+// Enable touch overflow scrolling when it's natively supported
$.mobile.touchOverflowEnabled = true;
+// Enabled zoom when touch overflow is enabled. Can cause usability issues, unfortunately
+$.mobile.touchOverflowZoomEnabled = false;
+
$( document ).bind( "pagecreate", function( event ) {
if( $.support.touchOverflow && $.mobile.touchOverflowEnabled ){
18 js/jquery.mobile.init.js
View
@@ -103,6 +103,24 @@
}
}
});
+
+ // This function injects a meta viewport tag to prevent scaling. Off by default, on by default when touchOverflow scrolling is enabled
+ function disableZoom() {
+ var cont = "user-scalable=no",
+ meta = $( "meta[name='viewport']" );
+
+ if( meta.length ){
+ meta.attr( "content", meta.attr( "content" ) + ", " + cont );
Markus Staab
staabm added a note

What happens when the user given meta tag defines user-scalabake=yes?

Good question. Maybe we should test if this overrides it or not. It's painful we had to add this at all, definitely don't want to disable zoom...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+ else{
+ $( "head" ).prepend( "<meta>", { "name": "viewport", "content": cont } );
+ }
+ }
+
+ // if touch-overflow is enabled, disable user scaling, as it creates usability issues
+ if( $.support.touchOverflow && $.mobile.touchOverflowEnabled && !$.mobile.touchOverflowZoomEnabled ){
+ disableZoom();
+ }
// initialize events now, after mobileinit has occurred
$.mobile._registerInternalEvents();
Markus Staab

What happens when the user given meta tag defines user-scalabake=yes?

Scott Jehl

Good question. Maybe we should test if this overrides it or not. It's painful we had to add this at all, definitely don't want to disable zoom...

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