日期:2014-05-16 浏览次数:20363 次
<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(function () {
var myDiv = $(".total-scope-tan");
$(".total-scope").click(function (event) {
$(".total-scope-tan").toggle();
$(document).one("click", function () {//对document绑定一个隐藏Div方法
$(myDiv).hide();
});
event.stopPropagation();//阻止事件向上冒泡
});
$(myDiv).click(function (event) {
event.stopPropagation();//阻止事件向上冒泡
});
});
});
</script>
<style type="text/css">
*{margin: 0;
padding: 0;
}
.total-scope {
width: 118px;
height: 20px;
border: 1px solid #DCDCDC;
background: #F6F6F6;
float: left;
line-height: 20px;
margin: 7px 0 0 10px;
display: inline;
cursor: pointer;
position: relative;
}
.total-scope .total-scope-tan{
width: 118px;
border: 1px solid #DCDCDC;
border-top: 0;
border-bottom: 0;
background: #FFF;
position: absolute;
top:21px;
left: -1px;
z-index: 99;
display: none;
}
.total-scope-tan a{
width: 118px;
height: 20px;
display: inline-block;
border-bottom: 1px solid #DCDCDC;
color: #7D7D7D;
line-height: 20px;
text-align: center;
}
.total-scope-tan a:hover{
background: #F6F6F6;
color: #E64545;
}
</style>
</head>
<body>
<div class="total-scope">
<span>最近7天</span>
<div class="total-scope-tan">
<a href="#">最近6天</a>
<a href