This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
scottjehl
committed
Sep 27, 2011
1 parent
1ad3eea
commit 47480d6
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
scottjehl
|
||
} | ||
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(); | ||
|
What happens when the user given meta tag defines user-scalabake=yes?