漂浮后显示 (不使用 tooltips)

 漂浮后显示 (不使用 tooltips)

 


漂浮后显示 (不使用 tooltips)
 

 

 

 

 

<td>
					<span class="hd2">概况</span> &nbsp;<span id="messageover" style="height:20px;" class="img-span why"></span>
</td>

<div id="messageovercontent" class="zib whycont">
	 <span style="font-weight:600">+++++:</span><br/>
	 <span >++++++++++</span><br/>
	 <span style="font-weight:600">@@@:</span><br/>
	 <span>@@@@@@@@@@@@@@@@@@@@@@</span><br/>
	 <span style="font-weight:600">###:</span><br/>
	 <span>######################</span>
 </div>

 

 

function getObUpperLeft(obj) {
	var curLeft = curTop = 0;
	if (obj.offsetParent) {
		curLeft = obj.offsetLeft;
		curTop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curLeft += obj.offsetLeft;
			curTop += obj.offsetTop;
		}
	}
	return [ curLeft, curTop ];
}


 $("#messageover").hover(function(){
				   var off = getObUpperLeft(this);
	               var x = off[0] + this.offsetWidth - 25;
	               var y = off[1] - 8;
	               
				   $("#messageovercontent").css({
					   top:y,
					   left:x
				   });
				   $("#messageovercontent").show();
			   },
			   function(){
				   $("#messageovercontent").hide();
			   });

 

 

 

你可能感兴趣的:(js,前端,漂浮后显示,tooltips)