首页导航点击A连接跳转并添加上背景色,
<style>
ul li {
float: left;
height: 50px;
width: 120px;
color: white;
text-align: center;
margin-left: 5px;
list-style-type: none;
}
a{
color:white;
text-decoration:none;
}
.menu{
height: 50px;
background: #0094ff;
line-height: 50px;
}
.bgcolor {
background: red;
}
</style>
<script>
$(document).ready(function () {
$('.menu li a').each(function () {
if ($($(this))[0].href == String(window.location))
$(this).parent().addClass('bgcolor');
});
})
</script>
<div class="menu">
<ul style="list-style-type: none;">
<li><a href="/Test/Home" title="网站首页" class="home">首页</a></li>
<li><a href="/Test/A" title="测试导航">A测试导航</a></li>
<li><a href="/Test/B" title="测试导航">B测试导航</a></li>
<li><a href="/Test/C" title="测试导航">C测试导航</a></li>
</ul>
</div>
最新文章
- React的使用与JSX的转换
- .pop ----remove 删除
- 转 git安装配置
- MAC系统生成RSA公钥私钥
- Nico Nico Ni~(完全背包)
- Android应用开发基础之九:内容提供者(ContentProvider)
- (转)freemakeer初入门
- iOS适配(Masonry)
- 问题:贴友关于CSS效果的实现
- html 5的localstorag
- Binder的非正常消亡时的重置方法
- .net调用Outlook 批量发送邮件,可指定Outlook中的账号来发送邮件
- Linux入门(3)——Ubuntu16.04下安装VMware
- ubuntu server 16.04 安装过程中提示无法安装busybox-initramfs
- 华为交换机批量加入 Vlan 方法
- 解决秒杀活动高并发出现负库存(Redis)
- 第二章 使用unittest模块扩展功能测试
- angular-translate
- HTTP错误405
- SQLSERVER 免费对比数据库结构和数据的工具支持:SQL Server 2012, SQL Server 2008 and SQL Server 2005