If you want to resize to fit Iframe content, then your resize code must be inside Iframe content. Since, as far as I know, only Iframe knows what content it contains, and not the parent window that loads it. In your Iframe Contents, put this code in the section of the chapter.
<script type="text/javascript"> function Resize_Box(){ var x = $('body').width(); var y = $('body').height(); parent.$.fn.colorbox.resize({ innerWidth: x, innerHeight: y }); } $(document).ready(function(){ Resize_Box(); }); </script>
When Iframe is fully loaded, this code will execute and your Colorbox will be resized. (Make sure this code only works if you use the same domain for the parent and iframe)
source share