国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

Layui實現數據表格中鼠標懸浮圖片放大效果,離開時恢復原圖的方法

2019-11-19 10:49:35
字體:
來源:轉載
供稿:網友

如下所示:

var tableIns = window.demoTable = table  .render({   elem : '#idTest',   id : 'idTest',   url : '<%=path%>/partyMember/getPartyMembersByOrgCode',   //width : 1500,   height : 'full',   cols : [ [ //標題欄    {checkbox : true,LAY_CHECKED : false,filter : 'test'},     {field: 'HEAD_URL', title: '頭像', width: 100, align: 'center',templet:'#imgTpl'},    //{field : 'PM_CODE',title : '黨員編號',width : 220,sort : true,align : 'center'},     {field : 'NAME',title : '黨員姓名',width : 110,sort : true,align : 'center'},     {field : 'SEX',title : '性別',width : 70,sort : true,align : 'center',templet:'#sexTpl'},     {field : 'AGE',title : '年齡',width : 70,sort : true,align : 'center'},     {field : 'PARTY_AGE',title : '黨齡',width : 70,sort : true,align : 'center'},     {field : 'BIRTH_DATE',title : '出生日期',width : 120,sort : true,align : 'center'},     {field : 'JOIN_PM_DATE',title : '入黨時間',width : 120,sort : true,align : 'center'},     {field : 'FULL_PM_DATE',title : '轉正時間',width : 120,sort : true,align : 'center'},     {field : 'TYPE',title : '類別',width : 120,sort : true,align : 'center',templet:'#typeTpl'},     {field : 'MOBILE_NO',title : '手機號碼',width : 150,sort : true,align : 'center'},     //{field : 'CODE',title : '組織編碼',width : 220,sort : true,align : 'center'},     {field : 'ORG_NAME',title : '所在支部',width : 230,sort : true,align : 'center'},     {field : 'UNIT_NAME',title : '所在單位',width : 220,sort : true,align : 'center'},     {fixed : 'right',title : '操作',width : 220,align : 'center',toolbar : '#barDemo'} ] ],   page : true //是否顯示分頁   ,   limits : [ 15, 20,50, 100 ],   limit : 15  //每頁默認顯示的數量   ,done:function(res,curr,count){    hoverOpenImg();//顯示大圖    $('table tr').on('click',function(){      $('table tr').css('background','');      $(this).css('background','<%=PropKit.use("config.properties").get("table_color")%>');     });   }  });

在done函數中調用hoverOpenImg方法,以及單擊表格行高亮的效果。

其中hoverOpenImg方法實現如下:

function hoverOpenImg(){  var img_show = null; // tips提示  $('td img').hover(function(){   //alert($(this).attr('src'));   var img = "<img class='img_msg' src='"+$(this).attr('src')+"' style='width:130px;' />";   img_show = layer.tips(img, this,{    tips:[2, 'rgba(41,41,41,.5)']    ,area: ['160px']   });  },function(){   layer.close(img_show);  });  $('td img').attr('style','max-width:70px'); }

同樣比較好理解,當td下的img被鼠標懸浮時,構造一個img元素,通過layer.tips方法在右邊渲染該圖片,當鼠標離開時,使用layer.close把當前提示框關閉,同時設置了下最大寬度max-width樣式。

效果如下:

鼠標懸浮時:

以上這篇Layui實現數據表格中鼠標懸浮圖片放大效果,離開時恢復原圖的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐业县| 南乐县| 宁国市| 泉州市| 四子王旗| 七台河市| 古丈县| 商丘市| 衡阳市| 繁昌县| 马公市| 巍山| 濮阳县| 宁强县| 化德县| 芮城县| 兴文县| 瑞丽市| 名山县| 静宁县| 江达县| 海盐县| 英吉沙县| 汕尾市| 全州县| 雷州市| 商城县| 巴林左旗| 延川县| 信丰县| 沾化县| 丰台区| 广汉市| 许昌县| 辽宁省| 马关县| 米林县| 嫩江县| 谢通门县| 丁青县| 甘德县|