user283188
user283188

Reputation: 287

javascript move image within a div

i have a div and and a looping move function that translates an image by 1px within the div. The width of the div is 400px; the image starts moving from right to left, but I can't figure out how to make it start appearing from behind the div border. Currently if I set a starting x-position at 405px and finishing x-position at -5 the image simply starts moving in front of the div. How do I make it so when it starts moving at 405 but only becomes visible once it crosses the div border at 400px?

thanks

Upvotes: 1

Views: 1659

Answers (1)

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124768

Use overflow: hidden; on the div and give it a width of 400px.

Upvotes: 2

Related Questions