鼠标放置后显示div,并在离开之前保持跟随鼠标的效果

function show(txt) {
 $('#suzhou').mousemove(function(e) {
  var ev = e || window.event;
  var x = ev.clientX;
  var y = ev.clientY;
  if(txt==""||txt==undefined||txt==null){
   $("#Tips").css("border-top-color","#D2691E");
   $("#txts").html("<span>未找到该地区企业数据<span>"); 
  }else{
   $("#txts").html(txt);  
  }
  $("#Tips").css({
   "left" : x + 10 + "px",
   "top" : y + 10 + "px"
  });
  $("#Tips").show();
 });
}
function hide() {
 $("#Tips").hide();
}

你可能感兴趣的:(跟随鼠标)