/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * 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);