表格td内容过多时,td显示省略号,鼠标移入显示全部内容
css文件:
html,body{
padding: 0px;margin: 0px;
}
table{
margin: 0px;
padding: 0px;
width: 30%;
border-collapse: collapse;
table-layout: fixed;
}
table td{
border: 1px solid #eef2e9;
white-space: nowrap;
overflow: hidden;
}
table td:hover {
overflow:auto;
text-overflow:clip;
}
js文件:
function titleAllTd() {
$("#ChaKanGrid tr td").each(function () {
$(this).attr("title", $(this).text());
$(this).css("cursor", 'pointer');
});
}
bootstrap table 应用时:
$(selectors.table).bootstrapTable({
url: #,
data: res,
method: 'get',
toolbar: '#toolbar',
striped: false,
pagination: true,
sidePagination: "client",
pageSize: 6,
pageList: [2, 4, 6, 8, 10],
queryParams: postFun,
responseHandler: responseHandler,
formatLoadingMessage: function () {
return '请稍等,正在加载中...';
},
columns: "",
onLoadSuccess:titleAllTd
})