<分区>
标签 javascript jquery html css
<分区>
我将我的网页分成几个部分(比如第 1 部分、第 2 部分等),这样我就可以从主菜单访问它们,使用相应的 href="#section1", href="#section2"等
这个菜单实际上是一个“ float 菜单”,这意味着它始终显示在顶部,即使您在页面上向下滚动也是如此。我想让菜单的按钮响应每时每刻显示的部分。例如,如果我正在查看“section2”,我希望“section2”按钮以不同的方式着色,或者使用粗体字母...
我猜这并不难,但在我看来真的很难找到它。 有什么线索吗?
提前致谢!
最佳答案
If You are using Bootstrap library.
It in build provides the option for selection of the button.
Plain HTML if you have used then you can use Javascript or JQuery library for button to be Selected with differnt CSS.
http://api.jquery.com/button-selector/
Button API can be used to select the button and change the CSS for the same.
关于javascript - 响应当前显示部分的网页元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26216908/