我正在使用页内链接锚点来平滑向下滚动我的页面。一切正常,每个链接都悬停在适当的图像上。但是,我希望活动部分有不同的图像来向用户显示他们在哪里。我似乎无法让它与任何东西一起使用。
这是我的 HTML
<div id="scrollnav">
<ul>
<li class="scrolldot"><span><a href="#one">1</a></span></li>
<li class="scrolldot"><span><a href="#two">2</a></span></li>
<li class="scrolldot"><span><a href="#three">3</a></span></li>
<li class="scrolldot"><span><a href="#four">4</a></span></li>
<li class="scrolldot"><span><a href="#five">5</a></span></li>
<li class="scrolldot"><span><a href="#six">6</a></span></li>
</ul>
</div>
这是我的 CSS
#scrollnav { width: 75px; height: 150px; position: fixed; right: 0; top: 100px; z-index: 999999;}
#scrollnav ul li { height: 16px; width: 16px; padding: 0px 0px 7px 0px; }
span { text-indent: -99999px; }
.scrolldot a { display: block; height: 16px; width: 16px; background-image: url(../images/dots.png); background-repeat: no-repeat; background-position: -16px 0; }
.scrolldot a:hover { background-image: url(../images/dots.png); background-repeat: no-repeat; background-position: 0 0; }
.selected { background-color: red; }
这是我将滚动到并希望处于活动状态的部分的示例。
<section id="one">
<div id="mainimagewrapper">
<div class="image1">
<div class="image2">
<div class="970content">
<div id="textdiv">
<h1>This is headline.</h1>
<p>This would be a description if someone wanted to write stuff here. This would be a description if someone wanted to write stuff here. This would be a description if someone wanted to write stuff here.</p>
</div>
</div>
</div>
</div>
</div>
</section>