How do I make my navbar change CSS class upon scrolling past an anchor point?

后端 未结 3 1535
眼角桃花
眼角桃花 2020-12-03 03:42

I\'m using Bootstrap 3 and want to achieve this effect when the user scrolls past the large header image on my page. I need the background of the navbar to go from transpare

3条回答
  •  时光取名叫无心
    2020-12-03 04:30

    You could probably just use javascript element.scrollTop along with Jquery addClass and removeClass. Haven't tried it myself though.

    Here's an overflow link for getting scrollbar position: How to get scrollbar position with Javascript?

提交回复
热议问题