0

I need to know how can I set auto height(as long as the content height) of fancybox of type 'iframe'?

I tried this little piece of code, but it's not working

<a class="fancybox fancybox.iframe" href="">Open Fancybox</a>

 $(".fancybox").fancybox({


                autoSize: true,
                autoHeight: true,
                autoWidth: true,
                fitToView: false,
                padding: 0,
                href: $(this).attr('href'),
                type: 'iframe',

            });
Ammar Khan
  • 346
  • 1
  • 9
  • 27
  • [this may help](http://stackoverflow.com/questions/10996212/auto-height-resizing-in-fancybox) – Pete Nov 06 '13 at 15:55
  • I already checked this out, but that doesn't work at all. – Ammar Khan Nov 06 '13 at 16:01
  • So you tried adding the beforeShow function to your options? you may want to make sure all your options are valid and you don't have any js errors (I see you have an extra comma at the end of the above options). Also make sure your fancybox selector within the function is correct. I used this and it worked fine for me - what version of fancybox are you using? – Pete Nov 06 '13 at 16:04
  • Yes, I used the beforeShow function. But I got this error in browser after I put this function "Blocked a frame with origin "http://localhost:32099" from accessing a frame with origin "iframe url". Protocols, domains, and ports must match." PS: I removed the extra comma from the fancybox script. – Ammar Khan Nov 06 '13 at 16:15
  • I am using version 2.1.5 – Ammar Khan Nov 06 '13 at 16:16
  • That sounds more like a [same origin error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript) – Pete Nov 06 '13 at 16:18
  • Aren't you missing anything in your link `href=""`?? – JFK Nov 06 '13 at 17:44
  • No, the proper link is there in href tag. I couldn't find out any solution. – Ammar Khan Nov 10 '13 at 20:38

0 Answers0