fancybox 2 iframe size does not change

醉酒当歌 提交于 2019-12-24 08:49:16

问题


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?


回答1:


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>



回答2:


Try this:

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


来源:https://stackoverflow.com/questions/13686431/fancybox-2-iframe-size-does-not-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!