开发者

jQuery bind position:absolute to an element

i have a situation of:

<div class="hey1"><img class="img1"></img></div>
<div class="hey2"><img class="img2"></img></div>
<div class="hey3"><img class="img3"></img></div开发者_StackOverflow>

so .img imgaes are in position:absolute; binded to right top corner of related .hey div

when i fadeOut(); for example .hey1 div, the other .hey2,.hey3 divs scrolls more on top (right) but images binded remains on same absolute position, what i would like is to bind .img images also when fading out related div

any way to do that?


Make sure your container divs have position.

Example: http://jsfiddle.net/redler/D6Ucg/

In the example, click a yellow box to make it fade out. Then see what happens if you re-run the test after removing the div { position: relative; } style.


Instead of positioning img elements absolutely with in div elements, position them relatively. This way they will move along with the div when div is re-positioned through scroll or programmatically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜