Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix Android variable VH units (when the browser's bar disappears vh change)
$(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);
}
});
@junorouse

This comment has been minimized.

Copy link

commented Sep 25, 2016

It doesn't work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.