Bootstrap4 导航active状态切换

页面HTML代码:

js代码如下:

$('.nav-pills').find('a').each(function () {
            if (this.href == document.location.href || document.location.href.search(this.href) >= 0) {
                $(this).addClass('active'); // this.className = 'active';
            }
        });

 

你可能感兴趣的:(H5,Bootstrap4)