Improved to take current position into account:

jQuery.swap( e, old, function() {
if (jQuery.css(e,"display") != "none") {
     oHeight = e.offsetHeight;
     oWidth = e.offsetWidth;
} else {
     e = $(e.cloneNode(true)).css({
         visibility: "hidden", position: "absolute", display: "block", 
right: "0", left: "0"
     }).prependTo(e.parentNode)[0];

     old["position"] = jQuery.css(e.parentNode,"position");
     if (old["position"] == "" || old["position"] == "static")
         e.parentNode.style.position = "relative";

     oHeight = e.clientHeight;
     oWidth = e.clientWidth;

     if (old["position"] == "" || old["position"] == "static")
         e.parentNode.style.position = "static";

     e.parentNode.removeChild(e);
}




-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to