当前位置: 代码迷 >> Web前端 >> 悬浮展示隐藏
  详细解决方案

悬浮展示隐藏

热度:112   发布时间:2013-03-04 17:22:12.0
悬浮显示隐藏

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
*{ padding:0; margin:0;}
body{ width:100%; height:800px;}
ul{ list-style:none;}
.wrap{ width:60px; position:relative;}
.wrap a{ height:16px; line-height:16px; display:block;}
.container{ display:none; width:150px; position:absolute; left:0; top:22px; border:1px solid #ccc;}
-->
</style>
<script type="text/javascript" src="http://js.letvcdn.com/js/201302/27/1630/www/core_min.js"></script>

</head>

<body>
<div class="wrap">
????? <a href="#">应用</a>
????? <div class="container">
????????? <ul>
????????????? <li>礼物</li>
????????????? <li>礼物</li>
????????????? <li>礼物</li>
????????????? <li>礼物</li>
????????? </ul>
????? </div>
</div>
<script type="text/javascript">
$('a').click(function(){$('.container').show();});

var timer = null;
? $('.wrap a').hover(function(){
??? clearTimeout(Timer);
??? //$(".container").show();??? ??? ??? ??? ??? ??
? },function(){
??? ?Timer = setTimeout(function(){
??? ??? ?$(".container").hide();
???? },200);
? });
$(".container").mouseover(function(){
??? clearTimeout(Timer);
?? $(".container").show();???
})
$(".container").mouseout(function(){
? Timer = setTimeout(function(){
??? ?$(".container").hide();
? },200);
})
</script>

</body>
</html>

  相关解决方案