使用jquery.flashgallery显示图库时,根据浏览器大小调整Div标签大小

时间:2012-03-27 07:13:08

标签: php jquery swfobject

<div id="banner">
    <script type="text/javascript" src="gallery/js/jquery.js"></script>
    <script type="text/javascript" src="gallery/js/swfobject.js"></script>
    <script type="text/javascript" src="gallery/js/flashgallery.js"></script>

    <script type="text/javascript">
    jQuery.flashgallery('gallery/gallery.swf', 'gallery/config.xml',{ width:'100%',    height:'100%', allowFullScreen: 'true', background: 'transparent'});
</script>



</div>

这里我想在调整浏览器窗口大小时调整横幅div的大小 可以帮一些人帮忙吧。

1 个答案:

答案 0 :(得分:0)

我的上一篇文章是偶然的,尝试这样的事情。我没试过。

$(window).resize(function() {
    var divRatio = .7;
    var divHeight = $(window).height()) * divRatio;
    var divWidth = $(window).width()) * divRatio;
    $('.yourDivYouWantHere').css({
        height : divHeight;
        width : divWidth;
    });
}

凯文