Jquery将隐藏div按照鼠标位置来显示

Html中:
<div id="div_syncFun" class="rTBotr"><a id="syncFun">同步</a></div>
<div id="div_allFun" class="rTBotr" style="display:none;z-index:210000; position:absolute;">...</div>

Jquery中:

 $("#syncFun").click(function(event){
	 var div = $("#div_allFun");
	 if(div.is(":hidden")){
		 div.show();
	 	 
//		 div.style.left=document.body.scrollLeft+event.clientX+10;
//		 div.style.top=document.body.scrollLeft+event.clientY+10;
		 div.css("left",document.body.scrollLeft+event.clientX+1);
		 div.css("top",document.body.scrollLeft+event.clientY+10);
		 div.css("background-color","#EFF7FE");
	 }else{
		div.hide(); 
	 }	
 });


 
 

你可能感兴趣的:(html,jquery,function,Class,div)