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.
- $(document).ready(function() {
- ...
- $(window).resize();
- ...
- });
- $(window).resize(function() {
- ...
- };
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 :
- $.fn.absolute_position = function(w, h, t, l)
- {
- $(this).attr('width', w);
- $(this).height(h);
- $(this).offset({
- top: t,
- left: l
- });
- };
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
- $(this).attr('width', w);
- $(this).width(w);
- $(this).css('width', w);
Any idea to solve this problem ? Thanks