javascript - 响应当前显示部分的网页元素

标签 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/

上一篇:css - 页面转换为可变页面内容保留页脚和页眉

下一篇:html - 两列图像网格

相关文章:

javascript - 复制从另一个表单输入的文件路径

javascript - jQuery 选择链接在 Chrome 上不起作用

javascript - 设置高度不随 jQuery 内联变化

javascript - 更新 Vue.js 中的嵌套父类

javascript - jQuery - $(this) + 选择器 - .each()

css - HTML 部分元素之间的间隙

html - 调整文字上划线的粗细

php - 带有下拉类别的搜索栏。搜索结果未从数据库中提取并显示

javascript - 相当于用数字键拼接一个对象

javascript - 我可以通过 https 请求在请求负载中看到清晰的密码,这正常吗?