JQuery - Position overlay div over another
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.
精彩评论