Skip to content
This repository
Browse code

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
authored September 27, 2011
4  js/jquery.mobile.fixHeaderFooter.native.js
@@ -7,8 +7,12 @@
7 7
 
8 8
 (function( $, undefined ) {
9 9
 
  10
+// Enable touch overflow scrolling when it's natively supported
10 11
 $.mobile.touchOverflowEnabled = true;
11 12
 
  13
+// Enabled zoom when touch overflow is enabled. Can cause usability issues, unfortunately
  14
+$.mobile.touchOverflowZoomEnabled = false;
  15
+
12 16
 $( document ).bind( "pagecreate", function( event ) {
13 17
 	if( $.support.touchOverflow && $.mobile.touchOverflowEnabled ){
14 18
 		
18  js/jquery.mobile.init.js
@@ -103,6 +103,24 @@
103 103
 			}
104 104
 		}
105 105
 	});
  106
+	
  107
+	// This function injects a meta viewport tag to prevent scaling. Off by default, on by default when touchOverflow scrolling is enabled
  108
+	function disableZoom() {
  109
+		var cont = "user-scalable=no",
  110
+			meta = $( "meta[name='viewport']" );
  111
+			
  112
+		if( meta.length ){
  113
+			meta.attr( "content", meta.attr( "content" ) + ", " + cont );
  114
+		}
  115
+		else{
  116
+			$( "head" ).prepend( "<meta>", { "name": "viewport", "content": cont } );
  117
+		}
  118
+	}
  119
+	
  120
+	// if touch-overflow is enabled, disable user scaling, as it creates usability issues
  121
+	if( $.support.touchOverflow && $.mobile.touchOverflowEnabled && !$.mobile.touchOverflowZoomEnabled ){
  122
+		disableZoom();
  123
+	}
106 124
 
107 125
 	// initialize events now, after mobileinit has occurred
108 126
 	$.mobile._registerInternalEvents();

0 notes on commit 47480d6

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.