Return to Snippet

Revision: 29548
at July 31, 2010 10:45 by terrencewood


Initial Code
/**
 * Makes elements absolutely positioned preserving the current top and left coordinates
 */
(function ($) {
    $.fn.makeabsolute = function () {
        return this.each(function () {
            var el = $(this);
            var pos = el.position();
            el.css({
                position: "absolute",
                marginLeft: 0,
                marginTop: 0,
                top: pos.top,
                left: pos.left
            });
        })
    }
})(jQuery);

Initial URL


Initial Description


Initial Title
jquery.makeabsolute

Initial Tags
jquery

Initial Language
JavaScript