Open chodorowicz opened 8 years ago
Are your problems resolved when initializing the buggyfill with { force: true }
? we don't always listen to resize
, but I don't remember why…
I've checked it and force: true
seems to work (although I don't understand why, I was thinking it would force px sizes on devices which support viewport units).
I've fixed this issue by adding (since disappearing tab bar on scroll triggers resize).
window.onresize = function() {
viewportUnitsBuggyfill.refresh();
};
edit
OK, now I understand https://github.com/rodneyrehm/viewport-units-buggyfill/blob/master/viewport-units-buggyfill.js#L173
So this docs is not clear for me:
// ignore user agent force initialization viewportUnitsBuggyfill.init({force: true});
I doesn't say that with force: true
you get onresize trigger too ;)
(maybe naive) It seems resize should trigger refresh by default (since resize changes viewport height/width).
@rodneyrehm I think I know the/one reason: I used buggyfill to prevent the annoying behaviour of the smartphone-resizing of the viewheight when scrolling up/down. With {force:true} this behaviour occured again. So I prefer @chodorowicz 's solution... thanks for the hint!
@tracid or @chodorowicz would you be able to provide an example as to the method you're using to fix the buggy behavior on mobile (address bar jumps).
Thanks so much (also I don't mean to hijack this thread).
@aulneau The solution is non-related with buggyfill script
The script recalculates on
orientationchange
event. I think we should recalculate dimensions on other events. One case I have currently problem with is scrolling on iOS Safari. When you scroll down the tab bar disappear and viewport height changes (expands by viewport height). We could usewindow.onresize
event. Maybe there's some other way?