I have a div with a relative position (div 1). It contains an image (shown as the green block) with an absolute position which by default is hidden way off to the left of the browser window.
I'd like to make it so that when div 1 is in the center of the browser window as the user scrolls down, the image is moved in slightly from the left and appears on the screen. As the user begins to scroll down past div 1, I'd like the image to move back to its original offscreen position.
I have attached a picture to try and make a bit more sense.
![enter image description here]
: http://i.stack.imgur.com/KMgug.jpg have a live example of the HTML structure?
以上就是Moving absolutely positioned image according to container div's position in the browser window的详细内容，更多请关注web前端其它相关文章！