给 title 提示文字加上CSS样式
<script>
var oldTitle = null;
$(document).bind('mouseover mouseout mousemove',function(event){
var left = event.pageX , top = event.pageY;
var ele = event.target;
var title = ele.title;
var type = event.originalEvent.type;
if(type == 'mouseover'){
oldTitle = title;
ele.title = '';
//if(title && title.length > 0){
if(title != null){
var showEle = $('<div></div>',{text:title,class:'showTitleBox'}).css({
position:'absolute',
top:top+10,
left:left,
border:'1px solid #CCC',
borderRadius:'5px',
background:"infobackground",
fontFamily:'SimHei',
fontSize: '50px'
})
showEle.appendTo('body');
}
}else if(type == 'mouseout'){
ele.title = oldTitle;
$('.showTitleBox').remove();
}else if(type == 'mousemove'){
$('.showTitleBox').css({
top:top+10,
left:left
})
}
})
</script>
信息科技 2020-04-10 08:14:30 通过 网页 浏览(3073) 打印
共有0条评论!