layui hover显示图片
table.render({ elem: "#table_list", url: "/table", cols: [ [ { checkbox: true, fixed: true }, { field: "id", title: "ID", align: "center", sort: true, width: 50 }, { field: "image", title: "图片"}, ] ], id: "listReload", page: true, height: "full-130", done:function(res,curr,count){ console.log("*****") hoverOpenImg();//hover显示大图 $('table tr').on('click',function(){ console.log("*****") $('table tr').css('background',''); $(this).css('background','<%=PropKit.use("config.properties").get("table_color")%>'); }); } }); function hoverOpenImg(){ var img_show = null; // tips提示 var kd,kd1 $('tbody tr').hover(function(){ // console.log($(this)[0].childNodes[5].innerText) kd=$(this).width(); kd1=kd*0.2; //图片放大倍数 var img = "<img class='img_msg' src='"+$(this)[0].childNodes[5].innerText+"?t"+Math.random()+"' style='width:"+kd1+"px;' />"; img_show = layer.tips(img,".input-cont",{time:0, tips: [3, '#ffffff']}); console.log(img) },function(){ layer.close(img_show); }); $('td img').attr('style','max-width:50px;display:block!important'); }