Fork me on GitHub

超简约前端点击图片弹窗放大(手机端)

.markImg{
            width:100%;
            height:100%;
            position:fixed;
            left:0;
            right:0;
            bottom:0;
            top:0;
            background:rgba(0,0,0,0.5);
            padding:15px;
            box-sizing:border-box;
            display:none;
        }
        .markImg img{
            width:100%;
            margin-top:40%;
        }


//图片
<img id="fileShow1Txt" src="" onclick="markFlags(this.src)">


//遮罩层
 <div class="markImg">
                <img id="fileShow1Txt2" src="" />
            </div>

//js点击事件
 function markFlags(img) {
            $('.markImg').fadeIn()
              $('.markImg img').attr('src', img)
        }
        $('.markImg').click(function () {
            $('.markImg').fadeOut()
        })

 

posted @ 2023-06-25 16:29  WantRemake  阅读(111)  评论(0编辑  收藏  举报