开发者

JQuery - Position overlay div over another

开发者 https://www.devze.com 2022-12-19 16:39 出处:网络
I am trying to lay one div over another. IE reports \"Invalid Argument\". Can anyone tell me what I am doing wrong please?

I am trying to lay one div over another. IE reports "Invalid Argument". Can anyone tell me what I am doing wrong please?

 var left = $("#container").offset().left;
 var top = $(开发者_运维技巧"#container").offset().top;
 $("#overlay").css({"left":left + "px", "top":top + "px"});


Apparently.. you cannot return false when calling the above method.

onclick="toggleOverlay();return true"

The above worked.


You must include return value from the function you call in an onclick. If you do not, it will become undefined and not run at all.

Without seeing the full function definition it is hard to say what was the full issue with your code.

0

精彩评论

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