banner图片全屏显示

复制代码
<script>
    $(function () {
        function reinitSize() {
            var window_h = $(window).height();
            var window_w = $(window).width();
            var main_h = window_h - 80;
            if (window_w > 960) {
                $("#myCarousel img").css({
                    width: "auto",
                    height: main_h + "px",
                    margin:"0 auto"
                });
            }
        }

        reinitSize();
        $(window).resize(function () {
            reinitSize();
        });
    })
</script>
复制代码
复制代码
#myCarousel img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}
 
复制代码
posted @ 2017-05-08 14:28  LD_Joy  阅读(434)  评论(0编辑  收藏  举报