jquery封装 e.relatedTarget
 
在mouseover中相当于IE的event.fromElement,在mouseout中相当于IE的event.toElement

 

<href="#" class="tip"> Test1 </a>
<href="#" class="tip"> Test2 </a>
<href="#" class="tip"> Test3 </a>
<div id="pop" class="test">
 
<br/>弹出层
 
<input size="12"/>
 
<href="#">aaaaaa</a>
 
<br/>
</div>

 

$(function(){
 $(
".tip").hover(function(e){
  $(
"#pop").css({
      
"position":"absolute",
      
"top": $(this).offset().top+$(this).outerHeight() ,
      
"left": $(this).offset().left 
     }).show();
 },
function(e){
  
if( $(e.relatedTarget).attr("id")!="pop"){    $("#pop").hide(); 
  }
 });
 $(
"#pop").bind("mouseleave",function(){
  $(
'#pop').hide();
 });
})

 

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-09-02
  • 2021-12-10
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2022-02-17
相关资源
相似解决方案