Colorbox: Automatically set the height and width of an iframe colorbox
When we are using iframe , then color box unaware about what content come in iframe,its height or its width. So we initially set a relevant height and width set a default width & height when opening colorbox with these options:
1 2 3 4 5 6 7 8 9 10 11 |
<script> var s=jQuery.noConflict(); s(document).ready(function(){ s(".iframe").colorbox({iframe:true, width:"50%", height:"70%"}); //Example of preserving a JavaScript event for inline calls. s("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); }); </script> |
Now when iframe loaded then Find height and width of your iframes content …