li內(nèi)容顯示不全
已經(jīng)設(shè)置不是第一個ul的內(nèi)容隱藏,理所當(dāng)然第一個ul就顯示,但是第一個ul的內(nèi)容中的span卻沒有顯示
<!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>無標(biāo)題文檔</title>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<style>
.title-active
{
color:#fff;
background:#0086c8;
}
.title-noActive
{
color:#0086c8;
}
#river
{
position:relative;}
#river>li
{
float:left;
list-style:none;}
.riverInfo
{
position:absolute;
top:50px;
left:0;}
.riverInfo li
{
border-radius:3px;
list-style:none;
border:1px solid #CCC;
padding:10px;}
</style>
</head>
<body> ? ??
<ul id="river">
? ? <li class="title-default title-active" style="margin-right:20px">天沙河(含雅瑤河)流域
? ? ? ? <ul class="riverInfo">
? ? ? ? ? ? <li><a href="#">(生活污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">(工業(yè)污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">(農(nóng)業(yè)污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">更多...</a></li>
? ? ? ? </ul>
? ? </li>
? ? <li class="title-default">杜阮河流域
? ? ? ? <ul class="riverInfo">
? ? ? ? ? ? <li><a href="#">信息公開(生活污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">信息公開(工業(yè)污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">(農(nóng)業(yè)污染源)</a><span>2016-05-18</span></li>
? ? ? ? ? ? <li><a href="#">更多...</a></li>
? ? ? ? </ul>
? ? </li>
</ul> ? ?
? ? ? ? ? ? <script type="text/javascript">
$(function() ?{
$('.riverInfo:not(:first)').hide();
$('#river>li').click(function(){
$(this).children().show();
$(this).siblings().children().hide();
});
$('.title-default').click(function(){
$(this).removeClass('title-noActive');
$(this).addClass('title-active').siblings().removeClass("title-active").addClass('title-noActive');
});
});
</script>
</body>
</html>
2016-08-17
是受它祖先元素li的樣式title-active影響的,那個樣式設(shè)置了它的color是白色的所以看不到
2016-08-17
1樓正解 ?受祖先元素的css顏色的影響,你改個其他的顏色就可以顯示了。