Pages

11 October 2011

Invalid Argument, jQuery bgiframe + position + iframe + IE6

Hi all,

Do you have an error when using jQuery bgiframe library together with jQuery UI position and your own frame? An error like: Invalid Argument. Which is actually very odd.

The problem when putting my own iframe behind a element that I want to position somewhere on the page with jQuery UI position function it throws the error. The error is thrown because jQuery UI position is automatically calling the bgiframe function if it exists. Here is the code:

Code:

if ( $.fn.bgiframe ) {
elem.bgiframe();
}

And now the line inside the bgiframe function where it throws the error:

I have made a workaround for myself - an ugly one but what else to do? :)
Here it is:

Code:

// Workaround - position is using the bgiframe when it exists and it fails when I have my own frame// If I remove my own frame - then there are problems when refreshing the content of the element that is positionedvar tempBgiframeFunction = $.fn.bgiframe;
$.fn.bgiframe = null;
// end workaround
$(positioningElement).position({
my: "left top",
at: "left bottom",
of: $(element),
collision: "fit"
});
// put back initial state - before workaround
$.fn.bgiframe = tempBgiframeFunction;