[英]Parallax effect not working in some browsers
Hi guys I am doing this parallax effect with CSS and HTML only. 大家好,我只用CSS和HTML做这种视差效果。 I am testing it for Desktop and it works on: Chrome, Firefox, IE and Spartan.
我正在针对桌面进行测试,并且可以在Chrome,Firefox,IE和Spartan上运行。
But I hit on the rock in the mobile test. 但是我在移动测试中一路狂奔。 Currently from my nexus 5:
目前来自我的联系5:
Firefox: works; Firefox:有效; Chrome: not-working;
Chrome:无法正常运作;
It is working on Chrome for iOS (for now tested on ipad mini only) 它可以在iOS版Chrome上运行(目前仅在ipad mini上测试过)
Is this a bug in the version? 这是版本中的错误吗? or I am missing something?
还是我缺少什么?
here is a live preview: 这是实时预览:
here is a js file I extracted for you to test: 这是我提取的js文件供您测试:
<div id="title" class="slide header"></div>
<div class="slide"></div>
.slide {
position: relative;
min-height: 100vh;
width: 100vw;
}
#title {
background-image: url("http://i.imgur.com/LzOCzLr.jpg");
background-attachment: fixed;
}
UPDATE: NOT WORKING ONLY ON CHROME MOBILE IN ANDROID 更新:不能只在安卓操作系统中使用
Remove the position:fixed and try this: https://jsfiddle.net/aatpa7qd/4/ 移除位置:固定并尝试以下操作: https : //jsfiddle.net/aatpa7qd/4/
$('body').scroll(function(){
$("#title").css({"background-position":"center " +($('body').scrollTop()*0.65) + "px"});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.