Created
June 12, 2013 20:01
-
-
Save kevin-smets/5768594 to your computer and use it in GitHub Desktop.
mobile webkit landscape locking hack
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
$(window).bind("orientationchange", -> | |
$scope.orientation = window.orientation | |
$(document.body).css({ | |
width: $(window).width() | |
height: $(window).height() | |
}) | |
if window.orientation % 180 is 0 | |
rotation = "rotate(-90deg)" | |
if window.orientation > 0 | |
rotation = "rotate(90deg)" | |
$(document.body).css({ | |
'-webkit-transition': "all 1s ease-in-out" | |
'-webkit-transform-origin': "" | |
'-webkit-transform': rotation | |
width: $(window).height() | |
height: $(window).width() | |
}) | |
else | |
$(document.body).css("-webkit-transform-origin", "").css "-webkit-transform", "" | |
).trigger "orientationchange" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment