开发者

Floating element position on resize (jQuery/CSS)

开发者 https://www.devze.com 2023-04-02 02:10 出处:网络
I have a hidden layer. When I click on an image the div appears over the image. However, if while the div is showing I resize the page, the the image will shift with the rest of the page elements but

I have a hidden layer. When I click on an image the div appears over the image. However, if while the div is showing I resize the page, the the image will shift with the rest of the page elements but the div remains in the same place where it appeared. Is there a way to make it stay relative to the image?

$(".myBox").css({"position":"absolute","wid开发者_C百科th":"400px"});


If I understand what you mean, which I think that I do, then you should just put position: relative; on your image.

0

精彩评论

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