jQuery:鼠标与div的坐标位置

jQuery鼠标与div的坐标位置

 

情景:当鼠标离开div时3秒后删除该div

该div的class为sp

 

 

function spon_out(event){
    var x=event.pageX-this.offsetLeft;
    var y=event.pageY-this.offsetTop;
   if(x < 0 || x > 260 || y < 0 || y > 100){
     removeDiv();
   }
  }
 

 

 

 $(".sp").mouseout(spon_out);
   

 

function removeSponsorDiv(){
    $('#sponsor_div').remove();
    //$(".sponsor_a").bind("mouseover",sponsor_fun);
  }
  function removeDiv(){
    sponsor_timer = setTimeout("removeSponsorDiv()",3000);
  }

 

    OK!

你可能感兴趣的:(jquery)