简体   繁体   中英

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?

Thanks

Depending on browser support, you could use multiple background images.

And you can always animate background-position.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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