gpt4 book ai didi

jquery - 当前页面菜单 's background color doesn' t 改变

转载 作者:行者123 更新时间:2023-11-28 08:44:53 25 4
gpt4 key购买 nike

这是 jsfiddle: http://jsfiddle.net/fht7zsm2/

我使用下面的代码更改当前页面的背景颜色

.sf-menu .active{
background-color:#1B3E70;
color:white;

}

我在页脚中放置了脚本下方。我也尝试放置在页眉中但不起作用:

<script>
$('.sf-menu a').click(function(){
$(this).addClass('active').siblings().removeClass('active');
});
</script>

我提到了这个: Change link color of the current page with CSS

http://jsfiddle.net/7VBy9/

最佳答案

只需删除 JSFiddle 的 JavaScript 部分中的标签。不需要它们。

http://jsfiddle.net/fht7zsm2/

$('.sf-menu a').click(function(){
$(this).addClass('active').siblings().removeClass('active');
});

关于jquery - 当前页面菜单 's background color doesn' t 改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27633918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com