1. 程式人生 > >圖片雙擊放大問題

圖片雙擊放大問題

在基於bootstrapTable動態載入表格為圖片時,實現圖片雙擊放大顯示預覽

$("#theTable").on('dblclick', "img[name='show_Photo']",function() {
    $('#bigPhoto>img').prop('src', $(this).prop('src'));
    $('#bigPhoto>img').css({
        //height : '480px',
        width : '800px'
    });
    if ($(this).prop('src') == null
|| $(this).prop('src') == '') return; layer.open({ type : 1, title : false, closeBtn : 0, area : [ '800px', '' ], skin : 'layui-layer-nobg', //沒有背景色 shadeClose : true, content : $('#bigPhoto') }); });

需放大圖片位置

這裡寫圖片描述

注:

layer.open({
        type :
1, title : false, closeBtn : 0, area : [ '800px', '' ], skin : 'layui-layer-nobg', //沒有背景色 shadeClose : true, content : $('#bigPhoto') });

這段程式碼需要layer的依賴