table 显示部分内容鼠标悬停显示全部的实现方法

一,引入layer.js插件(脚本文件);

二,自己在代码中添加脚本代码:

    

//描述鼠标悬停显示全部内容
$(function () {
    $("td").on("mouseenter",function() {
        if (this.offsetWidth < this.scrollWidth) {
            var that = this;
            var text = $(this).text();
            layer.tips(text, that,{
                tips: 1,
                time: 2000         //设置显示时间
            });
        }
    });
})
三,根据自己的喜好或者需求来改变显示的样式即可。

你可能感兴趣的:(插件,js,鼠标悬浮,悬浮显示,table,表格内容显示)