是否有可能视差img标签而不是背景图像在div? [英] Is it possible to parallax an img tag rather than background image in a div?
问题描述
我遇到了一些parallaxing教程(这一个特别我现在看着: http://net.tutsplus.com/tutorials/html-css-techniques/simple-parallax-scrolling-technique/ );然而,它们似乎都在一个固定的< div>
中包含背景图片。如果图像位于< img>
标签中,是否可以实现类似的视差效果?
I've come across a number of parallaxing tutorials (this one in particular I'm looking at now: http://net.tutsplus.com/tutorials/html-css-techniques/simple-parallax-scrolling-technique/); however, they all seem to involve a background image in a <div>
that's fixed. Is is possible to achieve a similar parallax effect if my image is in a <img>
tag?
推荐答案
假设您使用相同的属性,那么确定它可以
Provided you use the same attributes then yeah sure it can
An example of this can be seen here: http://webdesign.tutsplus.com/tutorials/complete-websites/create-a-parallax-scrolling-website-using-stellar-js/
这篇关于是否有可能视差img标签而不是背景图像在div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!