单击任何选项卡时如何更改选项卡的颜色?
问题描述:
这是我的HTML代码
here is my html code
<div id="header">
<div id="menu">
<ul class="current_page_itemm">
<li class="current_page_item"><a href="Home.aspx">Home</a></li>
<li><a href="JobSeekerlogin.aspx">Jobseeker Profiles</a></li>
<li><a href="#">Employer Profiles</a></li>
<li><a href="#">Jobs</a></li>
<li><a href="#">More</a></li>
</ul>
</div>
</div>
这里是css代码:
and here is css code :
#menu ul {
margin: 0;
padding: 25px 0 0 20px;
list-style: none;
line-height: normal;
}
#menu li {
display: block;
float: left;
}
#menu a {
display: block;
float: left;
margin-right: 17px;
padding: 5px 8px;
text-decoration: none;
font: 20px Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
}
#menu a:hover {
text-decoration: underline;
background: #910000;
color:#FFFFFF;
}
#menu a:active{
background: #910000;
color:black;
}
plz帮我搞定点击任何标签后的颜色变化效果,以便用户知道他们在哪个标签下工作?
plz help me to get the color change effect after clicking of any tab so that user should know under which tab they are working?
答
jQuery
jQuery 的一点点就可以做到这一点。我们在点击Tab时动态添加一个类('selected
')。
jQuery
Little bit of jQuery would do this trick. We are adding a class ('selected
') dynamically on click of Tab.
( document )。ready( function (){
(document).ready(function () {
(' #menu ul li a')。click( function (ev){
('#menu ul li a').click(function (ev) {