简体   繁体   English

如何拉伸背景图像以填充窗口并使其具有动画效果?

[英]How do I stretch a background image to fill the window and get it to animate?

For a project I'm working on I need to stretch a background image to fill the browser window and be able to have them transition via sliding eg. 对于我正在从事的项目,我需要拉伸背景图像以填充浏览器窗口, 能够通过滑动等使它们过渡。 Say you're on the home page, I'd want the user to be able to click on a navigation link for 'About', and then have the background image slide into a different image. 假设您在主页上,我希望用户能够单击“关于”的导航链接,然后将背景图像滑入另一幅图像。

Usually I'd use backstretch to stretch an image to fill the browser window, but I need to be able to slide to a new image. 通常我会用直道伸展的形象,以填补浏览器窗口,但我需要能够滑动到一个新的形象。

I can use backstretch to fill the window, and I can get the sliding working IF I'm using divs of fixed dimensions.. but is it possible to combine the two? 如果我使用固定尺寸的div,则可以使用反拉伸来填充窗口,并且可以进行滑动工作。但是可以将两者结合吗?

Thanks 谢谢

Depending on browser support, you could use multiple background images. 根据浏览器的支持,您可以使用多个背景图像。

And you can always animate background-position. 而且,您始终可以为背景位置设置动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM