功能:title属性的拓展:
对是否文本显示全没做出判断,当显示全时鼠标移上去不显示预览盒子;当显示不全时鼠标移上去显示预览盒子
_this.$element.find('.event-dictionary-table-item-list .e-matter').on('mouseover',function(){
var val = $(this).text();
var thisWidth = $(this).width(); // 文本div 的宽度
var wordWidth = $(this)[0].scrollWidth; // 先转为js对象; 文字的宽度
if(wordWidth > thisWidth){
$('.matter-box').text(val).css({
top:$(this).offset().top - 130 * Global.common.screen_level - $('.matter-box').height(),
left:$(this).offset().left - 1315 * Global.common.screen_level,
}).show();
}else{
$('.matter-box').html('').hide();
}
})
_this.$element.find('.event-dictionary-table-item-list .e-matter').on('mouseout',function(){
$('.matter-box').html('').hide();
})
效果展示