如何用颜色显示所选 link?
How to show selected link with a color?
我正在为我的项目尝试一个索引页面。我的索引左侧有一些 links page.if 我点击一个 link 相应的页面将是在 div.Currently 内显示 当鼠标经过 links..
时我已经完成了颜色显示
如何在点击 link 时显示我的 link 被选中。
我的部分代码在这里..如果你知道请帮助我...
<!DOCTYPE html>
<html lang="en">
<head>
<link href="style.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery-1.11.2.js"></script>
<script src="js/tooltipsy.min.js"></script>
<style type="text/css">
.leftpan{
margin-top: -23px;
margin-left: 5px;
alignment-adjust: width:295px;
float:left;
background:#004E96;
height: 960px;
border-radius: 10px;
}
.quickone{
border-radius:3px;
border:1px solid #357ec7;
margin:10px;
background:#fff;
}
a{
color:#fff;
text-decoration:none;
font-family: Arial;
font-weight: bold;
font-size: 11px;
}
.clearfix {
display: block;
}
.line{
background: none repeat scroll 0% 0% #004E96;
height: 4px;
margin: 10px 4px;
display: block;
overflow: hidden;
width: 100%;
margin-top: -20px;
}
.line1{
background: none repeat scroll 0% 0% #D8A455;
height: 4px;
margin: 10px 4px;
display: block;
overflow: hidden;
width: 100%;
margin-top: -7px;
}
.blue_bg, .blue_bg1 {
background-color: #004E96;
height: 4px;
width: 100%;
float: left;
margin-left: 5px;
}
.divdata{
margin-left: 304px;
margin-top: -23px;margin-bottom: 3px;
border-color: rgba(230, 240, 239, 0.34);
border-style: groove;
height:960px;
}
.btn:active {
transform: translate(0px, 5px);
-webkit-transform: translate(0px, 5px);
box-shadow: 0px 0px 0px 0px;
}
select{
margin-left: 6px;
font-size: 10px;
height: 22px;
}
</style>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$( document ).ready(function() {
$( "#page1" ).click(function() {
$('#showData').load('1.OrganisationalDetails.html');
});
$( "#page2" ).click(function() {
$('#showData').load('2.HumanResource.html');
});
$( "#page3" ).click(function() {
$('#showData').load('3.Risk.html');
});
$( "#page4" ).click(function() {
$('#showData').load('4.Customerprofile.html');
});
$( "#page5" ).click(function() {
$('#showData').load('5.BalanceSheet.html');
});
// $(function() {
// $(document).tooltip();
// });
});
</script>
</head>
<body>
<div class="main_wrapper clearfix">
<div class="header">
<h1 style="text-align:right; color:#004E96; text-shadow:yellow;" ></h1>
</div>
<div class="leftpan">
<div id="quickone">
<i class="sep"></i>
<li><label class="f14"><a id="page1" href="#">Organizational Details</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page2" href="#">Human Resource </a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page3" href="#">Risk Governance Structure& Business Model</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page4" href="#" >Customer Profile, Service, Complaints and Frauds</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page5" href="#" >Balance Sheet & Profit and Poss</a></label></li>
i>
</div>
</div>
<!--<div id="showData" style="clear:both;overflow:scroll;" class="divdata"></div>-->
<br>
<br>
</body>
</html>
使用此代码
css 访问过 link
a:visited{
color:red;
}
a:hover{
color:black;
}
对于当前行
在组织页面
添加 css
.page1{
color:green;
}
CSS class 可以 添加 单击 link,并且必须从其余部分中删除。
$('#quickone a').click(function() {
$('#quickone a').removeClass('selected');
$(this).addClass('selected');
});
将以下内容添加到您的 jQuery 和 CSS。
$(document).ready(function(){
$a = $("#quickone").find('a');
$a.click(function(){
$a.removeClass("active");
$(this).addClass("active");;
});
});
a.active{
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="main_wrapper clearfix">
<div class="header">
<h1 style="text-align:right; color:#004E96; text-shadow:yellow;" ></h1>
</div>
<div class="leftpan">
<div id="quickone">
<i class="sep"></i>
<li><label class="f14"><a id="page1" href="#">Organizational Details</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page2" href="#">Human Resource </a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page3" href="#">Risk Governance Structure& Business Model</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page4" href="#" >Customer Profile, Service, Complaints and Frauds</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page5" href="#" >Balance Sheet & Profit and Poss</a></label></li>
</div>
</div>
<!--<div id="showData" style="clear:both;overflow:scroll;" class="divdata"></div>-->
<br>
<br>
你可以选择 <li class="parent active">
在您的 <div>
tag.It 中将使您的选择 link 保持活动状态。
我正在为我的项目尝试一个索引页面。我的索引左侧有一些 links page.if 我点击一个 link 相应的页面将是在 div.Currently 内显示 当鼠标经过 links..
时我已经完成了颜色显示如何在点击 link 时显示我的 link 被选中。
我的部分代码在这里..如果你知道请帮助我...
<!DOCTYPE html>
<html lang="en">
<head>
<link href="style.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery-1.11.2.js"></script>
<script src="js/tooltipsy.min.js"></script>
<style type="text/css">
.leftpan{
margin-top: -23px;
margin-left: 5px;
alignment-adjust: width:295px;
float:left;
background:#004E96;
height: 960px;
border-radius: 10px;
}
.quickone{
border-radius:3px;
border:1px solid #357ec7;
margin:10px;
background:#fff;
}
a{
color:#fff;
text-decoration:none;
font-family: Arial;
font-weight: bold;
font-size: 11px;
}
.clearfix {
display: block;
}
.line{
background: none repeat scroll 0% 0% #004E96;
height: 4px;
margin: 10px 4px;
display: block;
overflow: hidden;
width: 100%;
margin-top: -20px;
}
.line1{
background: none repeat scroll 0% 0% #D8A455;
height: 4px;
margin: 10px 4px;
display: block;
overflow: hidden;
width: 100%;
margin-top: -7px;
}
.blue_bg, .blue_bg1 {
background-color: #004E96;
height: 4px;
width: 100%;
float: left;
margin-left: 5px;
}
.divdata{
margin-left: 304px;
margin-top: -23px;margin-bottom: 3px;
border-color: rgba(230, 240, 239, 0.34);
border-style: groove;
height:960px;
}
.btn:active {
transform: translate(0px, 5px);
-webkit-transform: translate(0px, 5px);
box-shadow: 0px 0px 0px 0px;
}
select{
margin-left: 6px;
font-size: 10px;
height: 22px;
}
</style>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script>
$( document ).ready(function() {
$( "#page1" ).click(function() {
$('#showData').load('1.OrganisationalDetails.html');
});
$( "#page2" ).click(function() {
$('#showData').load('2.HumanResource.html');
});
$( "#page3" ).click(function() {
$('#showData').load('3.Risk.html');
});
$( "#page4" ).click(function() {
$('#showData').load('4.Customerprofile.html');
});
$( "#page5" ).click(function() {
$('#showData').load('5.BalanceSheet.html');
});
// $(function() {
// $(document).tooltip();
// });
});
</script>
</head>
<body>
<div class="main_wrapper clearfix">
<div class="header">
<h1 style="text-align:right; color:#004E96; text-shadow:yellow;" ></h1>
</div>
<div class="leftpan">
<div id="quickone">
<i class="sep"></i>
<li><label class="f14"><a id="page1" href="#">Organizational Details</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page2" href="#">Human Resource </a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page3" href="#">Risk Governance Structure& Business Model</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page4" href="#" >Customer Profile, Service, Complaints and Frauds</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page5" href="#" >Balance Sheet & Profit and Poss</a></label></li>
i>
</div>
</div>
<!--<div id="showData" style="clear:both;overflow:scroll;" class="divdata"></div>-->
<br>
<br>
</body>
</html>
使用此代码 css 访问过 link
a:visited{
color:red;
}
a:hover{
color:black;
}
对于当前行 在组织页面 添加 css
.page1{
color:green;
}
CSS class 可以 添加 单击 link,并且必须从其余部分中删除。
$('#quickone a').click(function() {
$('#quickone a').removeClass('selected');
$(this).addClass('selected');
});
将以下内容添加到您的 jQuery 和 CSS。
$(document).ready(function(){
$a = $("#quickone").find('a');
$a.click(function(){
$a.removeClass("active");
$(this).addClass("active");;
});
});
a.active{
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="main_wrapper clearfix">
<div class="header">
<h1 style="text-align:right; color:#004E96; text-shadow:yellow;" ></h1>
</div>
<div class="leftpan">
<div id="quickone">
<i class="sep"></i>
<li><label class="f14"><a id="page1" href="#">Organizational Details</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page2" href="#">Human Resource </a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page3" href="#">Risk Governance Structure& Business Model</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page4" href="#" >Customer Profile, Service, Complaints and Frauds</a></label></li>
<i class="sep"></i>
<li><label class="f14"><a id="page5" href="#" >Balance Sheet & Profit and Poss</a></label></li>
</div>
</div>
<!--<div id="showData" style="clear:both;overflow:scroll;" class="divdata"></div>-->
<br>
<br>
你可以选择 <li class="parent active">
在您的 <div>
tag.It 中将使您的选择 link 保持活动状态。