The problem is that I have a few DIV's positioned absolutely which have background-size: cover; and their height is calculated by javascript to fill 100% of viewport. On every desktop browser and mobile firefox everything is fine, but on mobile chrome address bar (upon appearing/disappearing) changes $(windows).height(); value. That results in quirky background image rescaling every time it does that. Is there a workaround to always display address bar (so the window height value wouldn't change), or some other solution in keeping background-size: cover; scale the same regardless of the address bar?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I know you are speaking of Chrome, but in the case of mobile Safari, new as of ios 7.1, you can add the attribute to the viewport tag "minimal-ui" and this will prevent the navigation bar and the address bar from popping in and out.
Hopefully in the future other browsers, such as Mobile Chrome, will also accept this value.
You can read more here: http://www.mobilexweb.com/blog/ios-7-1-safari-minimal-ui-bugs
I solved a similar problem using:
I understand this is an older question, but the Chrome team has made a "fix" to this, which should prevent this issue in the future. It's currently in Canary, but it will hopefully end up in stable soon. It's planned for Chrome M56.
I wrote a little vanilla JS ES6 npm module to fix the issue:
address-bar-jump-fix
All you have to do is load the module and put a data-attribute on each jumping element.
This is what the script does (simplified):
The source is compiled to ES5 to support old browsers.