zoukankan      html  css  js  c++  java
  • layui 点击图片放大

            $(document).on('click', '.img_sp', function(data){
                var imgSrc=$(this).attr('src');
                layer.open({
                    type:1
                    ,title:false
                    ,closeBtn:0
                    ,skin:'layui-layer-nobg'
                    ,shadeClose:true
                    ,content:'<img style="100%;height:100%;" class="layui-upload-img" src="'+ imgSrc +'"/>'
                    ,scrollbar:false
                })
            });
    var area = [];
            if (window.screen.width > 1680 && window.screen.width <= 1920) {
                area = ['58%', '96%']
            } else if (window.screen.width > 1600 && window.screen.width <= 1680) {
                area = ['78%', '86%']
            } else if (window.screen.width > 1366 && window.screen.width <= 1600) {
                area = ['78%', '86%']
            } else if (window.screen.width <= 1366) {
                area = ['78%', '86%']
            }
    
            $(document).on('click','.imgs',function(){
                layer.open({
                    type: 1,
                    title: false,
                    closeBtn: 0,
                    shadeClose: true, //点击阴影关闭
                    area: area , //宽高
                    // area: [$(this).width + 'px', $(this).height + 'px'], //宽高
                    content: "<img src=" + $(this).attr('src') + " />"
                });
            });
  • 相关阅读:
    .net 有游戏框架了?庆祝下
    python爬虫解决gbk乱码问题
    N46期第10周作业
    N46期第四周作业
    N46期第三周作业
    N46期第九周作业
    月考
    第二阶段
    N46期第八周作业
    第七周
  • 原文地址:https://www.cnblogs.com/bkhdd/p/15620753.html
Copyright © 2011-2022 走看看