JQuery and Colorbox: how to automatically set the height and width of the color iframe colorbox

I downloaded the latest colorbox jquery plugin . now i set true colorbox for iframe and inline. my problem colorbox (lightboxes) is not set to automatic height / width of the shape of the external page. How to fix it? Is there any way to do this?

MY colorbox function:

<script>
$(document).ready(function(){
 $(".iframe").colorbox({inline:true,iframe:true});
</script> 

thank

+5
source share
1 answer

Since colorbox will not know what is inside the iframe, auto-size cannot work as you expect.

I do it like this: set default width + height when opening colorbox with these options:

{ iframe: true, innerWidth: 430, innerHeight: 370, scrolling: false, ... }

, : colorbox iframe . iframe html script, iframe:

$(function(){
    parent.$.colorbox.resize({
        innerWidth:$('body').width(),
        innerHeight:$('body').height()
    });
});

script jQuery iframe. JavaScript.

, iframe /, . innerWidth/innerHeight .

+19

All Articles