在CSS / HTML / JS中制作某种透明的玻璃图像

杰森

查看此网站时:http : //myankle.co.uk/faq/

每当您上下滚动时,脚踝的图像都会改变。我知道您可以使div不透明并在其后放置图像,但是如何实现此效果?图像似乎随页面一起移动。

盖伊

这是通过将背景设置为来实现的background-attachment: fixed效果是视差的基本实现。

入门的好文章是http://davidwalsh.name/parallax

一个适用的示例类是:

.parallax {
  background-image: url('http://demoimage.com/image.jpg');
  background-color: none !important;
  background-position: top center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed; // For mobile this should be scroll to fix bugs with ios
  overflow-y: hidden;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章