查看大图

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33242730/article/details/79969694
<div class="allSeeBigImg"><img src="" alt=""></div>
var isSeeBigImg = true, clientWidth = $(window).width(), clientHenght = $(window).height(), CHCWrotia = clientHenght / clientWidth
        $('.new_anser_imgs').on('click','img',function(){
            var src = $(this).prop('src')
            $('.allSeeBigImg img').prop('src',src)
            var imgWidth = $(this).width()
            var imgHeight = $(this).height()
            var IHIWrotia = imgHeight / imgWidth
            if(IHIWrotia < CHCWrotia){
                $('.allSeeBigImg img').css({
                    'width':'100%',
                    'height':'auto'
                })
            }else{
                $('.allSeeBigImg img').css({
                    'width':'auto',
                    'height':'100%'
                })
            }
            $('.allSeeBigImg').stop().fadeIn(200)
        })
        $('.allSeeBigImg').click(function () {
            $(this).stop().fadeOut(200)
        })
.allSeeBigImg{
    width:100%;
    height:100%;
    position:fixed;
    top:0;
    left:0;
    background:#000;
    z-index:10000;
    display:none;
    overflow: hidden;
}
.allSeeBigImg::-webkit-scrollbar{
    display: none;
}
.allSeeBigImg img{
    position:absolute;
    top:50%;
    left:50%;
    -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
}
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页