我的页面左侧有 12 个链接,它们锚定到页面右侧的 12 个 div。每当我向下滚动时,我希望链接的颜色在 div 悬停时改变。
问题:1.) 12 个链接位于嵌套 div 中 2.) 右侧的 div 位于链接之后的单独嵌套 div 中。
我尝试使用此代码: http: //jsfiddle.net/gU4sw/7/但随后切换回来,因为它不适用于嵌套的 div。
有没有办法解决这个问题?这是我到目前为止所拥有的。我还没有插入所有的 div,因为我正在等待先解决这个问题。
HTML:
<body>
<body style="margin:0px;">
<div id="wrapper">
<div id="navbar">
<div id="navbartext">
<div class="center">
<div id="morning"><a href="index.html">MORNING</a></div><br/>
<div id="one"><a href="#7:30">7:30</a></div><br/>
<div id="two"><a href="#8:00">8:00</a></div><br/>
<div id="three"><a href="#10:00">10:00</a></div><br/>
<div id="noon"><a href="#NOON">NOON</a></div><br/>
<div id="five"><a href="#2:00">2:00</a></div><br/>
<div id="six"><a href="#5:00">5:00</a></div><br/>
<div id="seven"><a href="#5:15">5:15</a></div><br/>
<div id="night"><a href="#NIGHT">NIGHT</a></div><br/>
<div id="nine"><a href="#9:00">9:00</a></div><br/>
<div id="ten"><a href="#12:00">12:00</a></div><br/>
<div id="eleven"><a href="#3:00">3:00</a></div><br/>
</div>
</div>
</div>
</div>
<div id="content">
<div id="subcontent">
<br/><br/><br/><br/><br/><br/><img src="images/myday.png" width="613" height="287" /> <br/><br/><br/><br/>
<h5>↓SCROLL DOWN↓</h5><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<a name="7:30"><div class="img"><img src="images/cal.gif" width="640" height="" /></div></a>
<a name="9:00"><div class="img"><img src="img.jpeg" width="640" height="" /></div></a>
</div>
</div>
</body>
</body>
</html>
CSS: $0@charset "UTF-8"; /* CSS 文档 */
#wrapper {margin: 0px;}
/*Navigation Bar*/
#navbar {background:#FF9999;
padding:15px;
position:fixed;
left: 90px;
width:115px;
height:100%;}
#navbartext { top: 50%;
width: 115px;
height: 100%;}
a:link {color: #FFF;
font-family: 'Quicksand', sans-serif;
font-size: 24px;
text-align: center;
font-weight: 300;
text-decoration: none;}
a:visited {color: #FFf;}
a:active {color: #FFf58A;}
a:hover {color: #FFF58A;}
img:hover + a {color: #FFF58A;}
.center {display: inline-block;
vertical-align: middle;
background: #FF9999;
width: 115px;
color: #FFF;
height: 100%;
text-align: center;
margin: 0px;}
#morning {width:115px;
position: absolute;
top: 3%}
#one {width:115px;
top: 11%;
position: absolute;}
#two {width:115px;
top: 19.4%;
position: absolute;}
#three {width:115px;
top: 27%;
position: absolute;}
#noon {width:115px;
top: 35%;
position: absolute;}
#five {width:115px;
top: 43%;
position: absolute;}
#six {width:115px;
top: 51%;
position: absolute;}
#seven {width:115px;
top: 59%;
position: absolute;}
#night {width:115px;
top: 67%;
position: absolute;}
#nine {width:115px;
top: 75%;
position: absolute;}
#ten {width:115px;
top: 83%;
position: absolute;}
#eleven {width:115px;
top: 91%;
position:absolute;}
/*Content*/
#content {height: 10000px;
padding-top: 45px;
margin-left: 200px;
text-align: center;
font-family: 'Quicksand', sans-serif;
font-size: 24px;
color: #cda8cb;}
#subcontent {width: 950px;
margin: 0 auto;}
.img {top: 50%;
left: 50%;
display: table-cell;
margin: auto;
vertical-align: middle;
width: 950px;
padding-top: 175px;
padding-bottom: 200px;
img: hover + a color: #FFF58A;}
/*text*/
<h4> {color: #FFF;
font-family: 'Quicksand', sans-serif;
font-size: 24px;
text-align: center;
font-weight: 300;
line-height: 260%;
vertical-align: middle;}
<h5> {font-color: #cda8cb;
font-size: 24px;
text-align: center;
font-weight: 100;
line-height: 260%;
vertical-align: middle;}
/*
#content {height:10000px;
padding-top:45px;
margin-left: 350px;}
#subcontent {width: 950px;
height: 950px;
margin: 0 auto;
}
#navbartext {}
#navbartext {}
#myday {padding-top: 110px;}