Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should be recalculated on resize? #70

Open
chodorowicz opened this issue Apr 12, 2016 · 5 comments
Open

Should be recalculated on resize? #70

chodorowicz opened this issue Apr 12, 2016 · 5 comments

Comments

@chodorowicz
Copy link

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 use window.onresize event. Maybe there's some other way?

@chodorowicz chodorowicz changed the title Should be recalculated on resize. Should be recalculated on resize? Apr 12, 2016
@rodneyrehm
Copy link
Owner

Are your problems resolved when initializing the buggyfill with { force: true }? we don't always listen to resize, but I don't remember why…

@chodorowicz
Copy link
Author

chodorowicz commented Apr 15, 2016

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).

@tracid
Copy link

tracid commented Apr 15, 2016

@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!

@aulneau
Copy link

aulneau commented May 26, 2016

@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).

@lucho20pt
Copy link

@aulneau
The solution is non-related with buggyfill script

  • you only see it jumping when you are using VH units
  • You can fix it by using only VW units for every scenario - width / heigth / (...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants