fancybox 2 iframe size does not change

2019-08-14 14:11发布

I'm using fancybox to open external urls. I tired this code for fancybox-html class a href:

$(document).ready(function() {  
    $(".fancybox-html").fancybox({
    fitToView   : false,
    width       : '90%',
    height      : '90%',
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none'
    });
});

HTML:

    <script type="text/javascript" src="http://localhost:8000/media/js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="http://localhost:8000/media/js/jquery.pageslide.min.js"></script>

    <script type="text/javascript" src="http://localhost:8000/media/js/autocomplete.js"></script>
    <!-- <script type="text/javascript" src="http://localhost:8000/media/js/overlay.js"></script> -->

    <!-- FancyBox -->
    <link href="http://localhost:8000/media/fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://localhost:8000/media/fancybox/jquery.fancybox.pack.js"></script>
    <script type="text/javascript" src="http://localhost:8000/media/fancybox/jquery.easing-1.3.pack.js"></script>
    <script type="text/javascript" src="http://localhost:8000/media/fancybox/jquery.mousewheel-3.0.6.pack.js"></script>

this did not work, the iframe opens in different dimensions like it ignores my settings. is it possible to debug it?

maybe I'm missing some libraries.

Any ideas?

2条回答
Ridiculous、
2楼-- · 2019-08-14 14:43

Try this:

$(document).ready(function() {  
    $(".fancybox-html").fancybox({
    fitToView   : false,
    frameWidth  : '90%',
    frameHeight : '90%',
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none'
    });
});
查看更多
来,给爷笑一个
3楼-- · 2019-08-14 14:46

First you have to download the last fancybox to be sure. Include the js and the css into your page then, try to use this code if is an iframe. If doesn't work post your html please to see if you have an error

     $(".fancybox-html").fancybox({ 
width    : '75%', 
height   : '75%', 
autoSize    : false, 
closeClick  : false, 
fitToView   : false, 
openEffect  : 'none', 
closeEffect : 'none', 
type : 'iframe' 
});


<a href="yourpage.php" class="fancybox-html">test test</a>
查看更多
登录 后发表回答