Opened window doesn't have correct width/height if % is used

Create issue
Issue #41 new
Former user created an issue

If percentages are used to define with or height on opened modal window. It doesn't opens with the correct size.

The problem is located at the block {{{ // iframe $iframe = $('<iframe src="'+ $elt.attr("href") +'" name="'+ $elt.attr("href") +'" frameborder="0" scrolling="auto" hspace="0" width="'+ curSettings.boxWidth +'" height="'+ curSettings.boxHeight +'"></iframe>'); // On iframe load $iframe.load(function(){

// Specified dimensions
$superbox.width( curSettings.boxWidth+"px" );
$innerbox.height( curSettings.boxHeight+"px" );
                                            }

}}}

as you can see, if the superbox container is a percent size, the iframe "contained" should have 100% size of the container. If we also applies the percent size, the the iframe is shrinked from the container window. Also, always "px" is appended, so when "90%" is used the superbox width is assigned to "90%px"

Solution is to evaluate sizes and if percentages are used, doesn't append "px"

{{{ // iframe $iframe = $('<iframe src="'+ $elt.attr("href") +'" name="'+ $elt.attr("href") +'" frameborder="0" scrolling="auto" hspace="0" width="'+ (curSettings.boxWidth.search(/.*%/) == -1 ? curSettings.boxWidth : "100%") +'" height="'+ curSettings.boxHeight +'"></iframe>');

// On iframe load $iframe.load(function(){

// Specified dimensions
$superbox.width( curSettings.boxWidth+(curSettings.boxWidth.search(/.*%/) == -1 ? "px" : "") );
$innerbox.height( curSettings.boxHeight+(curSettings.boxHeight.search(/.*%/) == -1 ? "px" : "") );

}}}

Hopping to see this change code in next version...

Vicente Salvador

Comments (0)

  1. Log in to comment