Posted By


terrencewood on 07/31/10

Tagged


Statistics


Viewed 571 times
Favorited by 0 user(s)

jquery.makeabsolute


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2.  * Makes elements absolutely positioned preserving the current top and left coordinates
  3.  */
  4. (function ($) {
  5. $.fn.makeabsolute = function () {
  6. return this.each(function () {
  7. var el = $(this);
  8. var pos = el.position();
  9. el.css({
  10. position: "absolute",
  11. marginLeft: 0,
  12. marginTop: 0,
  13. top: pos.top,
  14. left: pos.left
  15. });
  16. })
  17. }
  18. })(jQuery);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.