Fancybox iframe

<a class="fancybox fancybox.iframe" href="http://www.google.be/">This goes to iframe</a>
<script type="text/javascript">
    $(document).ready(function() {

        $('a.fancybox').fancybox();

    });
</script>
There are three ways to tell fancybox to do it :
1). Add type: "iframe" to your custom script like :
$('a.fancybox').fancybox({
   type: "iframe"
});
2). Add the attribute data-fancybox-type="iframe" to your <a> anchor tag like :
<a class="iframe" href="http://www.google.be/" data-fancybox-type="iframe">This goes to iframe</a>
It requires HTML5 DOCTYPE though.
3). Add the special class fancybox.iframe to your <a> anchor tag as in the accepted answer.
The fancybox script is able to evaluate any of the states above but you should choose at least one of them to make it work (you could use more than one or altogether and it will work, but it's redundant)
NOTE : this is valid for fancybox v2.x+ only (... and requires jQuery v1.6 or later)

Комментарии