开发者

JQuery Offset problem

开发者 https://www.devze.com 2023-01-16 02:23 出处:网络
I have a div on page load has the css \"Display:none; position:absolute\" There is a jQuery click event on a label that shows this div

I have a div on page load has the css "Display:none; position:absolute"

There is a jQuery click event on a label that shows this div

B开发者_如何转开发efore I do .fadeIn() on I find the width and height of the window and set the offset of the div to try place to div in the centre of the screen.

This div also has a close image that has a jQuery click event that sets the div to fade out

The first time I open the div the div is positioned correctly on the screen, if I close the div and open it the div moves further right and down. It keeps on doing this until I do a full page refresh


Can you post the code? Especialy the part that sets the position of the div. It sounds like you are repositioning every time the div is displayed, rather than once on page load.

0

精彩评论

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