How to stop a background from resizing on mobile when an adress bar is hiding to prevent jumping?

Viewed 59

I'm using Create React App. My current CSS:

background: url(/src/images/planet.jpg) no-repeat center
  center fixed;
background-size: cover;

Problem (Mobile devices) : Scrolling causes an adress bar hiding and because the viewport height changes, the background needs to rescale which causes ugly jumping.

My idea: I need some kind of solution that calculates the background size from the current device screen size instead from the viewport which is affected by the adress bar. Or maybe I should somehow put the background image under the adress bar (different layer)?

Please help good people :)

0 Answers
Related