Created
November 22, 2014 08:41
-
-
Save fregante/9cc4eeca13c68e16c1f6 to your computer and use it in GitHub Desktop.
Fix Android variable VH units (when the browser's bar disappears vh change)
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
$(function () { | |
var $els; | |
var updateHeight = function () { | |
$els.css('height', ''); // reset previously-set height | |
$els.height($els.height());// set the current height in px | |
}; | |
if (/android/i.test(navigator.userAgent)) { | |
$els = $('ELEMENTS-WITH-VH-UNITS'); | |
updateHeight();//set instantly | |
$(window).on('orientationchange.vh-height-set', updateHeight); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It doesn't work..