Object disparition when setting its size

Object disparition when setting its size

Hello

Here is my issue : I have one global resize function when the window is resized, and I also call this function as soon as my document is ready. This treatment consists in absolute positionning of various <object> on the screen with regards to the window current size.
  1. $(document).ready(function() {
  2. ...
  3.   $(window).resize();
  4. ...
  5. });
  6. $(window).resize(function() {
  7. ...
  8. };

When I load my page, my screen seams to be empty, as if <object> were hidden, but if a resize my window, objects appear properly in the resized window.

Step by step, I finally found that the problem comes from these lines in my function absolute_position that centralises the sizing and absolute positionning :
  1. $.fn.absolute_position = function(w, h, t, l)
  2. {
  3.   $(this).attr('width', w);
  4.   $(this).height(h);
  5.   $(this).offset({
  6.       top: t,
  7.       left: l
  8.   });
  9. };
In fact if I comment the two first lines, that is to say, that I don't resize my <object>, then objects appear (of course with bad size) both at the document loading and at the window resizing.

I tried various writing, but the behavior is unchanged
  1. $(this).attr('width', w);
  2. $(this).width(w);
  3. $(this).css('width', w);
Any idea to solve this problem ? Thanks