PHP Developers Network
http://forums.devnetwork.net/

Can I animate a background wallpaper, slow left.. then right
http://forums.devnetwork.net/viewtopic.php?f=68&t=141412
Page 1 of 1

Author:  simonmlewis [ Wed Jun 10, 2015 5:06 pm ]
Post subject:  Can I animate a background wallpaper, slow left.. then right

I have a DIV with a large background image, set to be 100% width, so it's stretched to fit. It's clouds.

I'd like the image to slowly go across the DIV.. and when it reaches the end, it goes back the other way. so it's like clouds moving at the top of the web site.

I've seen a few animations in CSS, but they seem to just slide the whole image left to right. I need the image to be like perhaps 120% of the DIV, so when it moves left to right, there are no "gaps" left or right. So it looks like you are looking outside.

Is this poss?
Attached is the image I am using.

Attachments:
File comment: Cloud background
bg_topcloud.jpg
bg_topcloud.jpg [ 105.52 KiB | Viewed 4698 times ]

Author:  Celauran [ Wed Jun 10, 2015 7:22 pm ]
Post subject:  Re: Can I animate a background wallpaper, slow left.. then r

Front end is definitely not my strong suit, but what if you used an image that was wider than the div you're trying to fill and give it negative positioning so its edge is 'off canvas'. As you slide it, you're just pulling more image in and pushing the other side off canvas.

Author:  simonmlewis [ Thu Jun 11, 2015 2:37 am ]
Post subject:  Re: Can I animate a background wallpaper, slow left.. then r

How would you tell it to fill the DIV, and be a background image, and positioned "off" the page to the left?

Author:  Celauran [ Thu Jun 11, 2015 6:50 am ]
Post subject:  Re: Can I animate a background wallpaper, slow left.. then r

https://developer.mozilla.org/en-US/doc ... background

background-position

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/