所以,我正在開發的網站是:
This is what happens when you CLICK on a menu and scroll to Roofing Services We offer:

I think that the ACTIVE menu is TIED together, meaning, when the addEventListener() is hit, it REMOVES ALL active classes from everything, hence, the reason.
如果有人可以幫助我,我將不勝感激。謝謝你。
uj5u.com熱心網友回復:
標簽上的點擊處理程式正在向<a>標簽添加/洗掉.active類,<a>但它應該對父<li>標簽執行此操作:
$('#ftco-nav .navbar-nav li a').click((e) => {
$('#ftco-nav .active').removeClass('active');
$(e).parent().addClass('active');
// ...
}
您的滾動處理程式有類似的問題。它應該.active從標簽中添加/洗掉類<li >,而不是<a>標簽:
if ($(this).position().top <= distance 250) {
$('ftco-nav .navbar-nav .nav-item.active').removeClass('active');
$('#ftco-nav .navbar-nav a').eq(i).parent().addClass('active');
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/438236.html
標籤:javascript html jQuery css 推特引导
