窗口滚动和导航

人气:597 发布:2022-09-22 标签: jquery

问题描述

我有一个类似的导航:

i have a nav like:

<ul>
    <li value="sec1"></li>
    <li value="sec2"></li>
    <li value="sec3"></li>
    <li value="sec4"></li>
</ul>

和页面上的4个部分,例如

and 4 sections on the page like

<section id="sec1"></section>
<section id="sec2"></section>
<section id="sec3"></section>
<section id="sec4"></section>

i想以某种方式将部分绑定到菜单项,所以当 用户滚动页面并逐个跨越部分 时,相应的菜单项变得高亮! (使用jquery)

i want to somehow bind sections to menu items so when user scrolls the page and crosses sections one by one , respective menu item get hilighted! (using jquery)

推荐答案

我创建了一个演示。 请看看 - [演示]李突出显示部分悬停。 [ ^ ]。 [更新] 好​​的。我找到了一个小提琴。 看一看 - http:// jsfiddle。 net / x3V6Y / [ ^ ]。 这正是您所需要的。 I have created a Demo. Please take a look - [Demo] LI Highlighting on Section Hover.[^]. [Update] Okay. I found one fiddle for you. Take a look- http://jsfiddle.net/x3V6Y/[^]. This is exactly what you needed.

784