我的 JQuery 脚本:
$(document).ready(function(){
$('.both').click(function (event){
$("#cl").fadeOut().removeClass("showTemp").addClass("showTempH");
$("#nc").fadeOut().removeClass("showTemp").addClass("showTempH");
$("#bth").fadeIn().removeClass("showTempH").addClass("showTemp");
$(".both").removeClass("demo").addClass("active");
$(".clinical").removeClass("active").addClass("demo");
$(".nonclinical").removeClass("active").addClass("demo");
});
$('.clinical').click(function (event){
$("#cl").fadeIn().removeClass("showTempH").addClass("showTemp");
$("#nc").fadeOut().removeClass("showTemp").addClass("showTempH");
$("#bth").fadeOut().removeClass("showTemp").addClass("showTempH");
$(".both").removeClass("active").addClass("demo");
$(".clinical").removeClass("demo").addClass("active");
$(".nonclinical").removeClass("active").addClass("demo");
});
$('.nonclinical').click(function (event){
$("#cl").fadeOut().removeClass("showTemp").addClass("showTempH");
$("#nc").fadeIn().removeClass("showTempH").addClass("showTemp");
$("#bth").fadeOut().removeClass("showTemp").addClass("showTempH");
$(".both").removeClass("active").addClass("demo");
$(".clinical").removeClass("active").addClass("demo");
$(".nonclinical").removeClass("demo").addClass("active");
});
});
我的 CSS 代码:
.demo {
margin: 0px auto;
display: block; /* Change anchor to block element */
width: 195px; height: 37px; /* Specify width and height of the image. Height is value of each individual button graphic */
background-image: url(theImages/inactive.png); /* Add the image as a background */
background-position: top; /* Set the position to the top */
text-align: center;
vertical-align: middle;
line-height: 37px; /* the same as your div height */
font-size: 13px;
font-weight: bold;
color: #FCFCFC;
}
.demo:hover {
cursor: pointer;
}
.active {
margin: 0px auto;
display: block; /* Change anchor to block element */
width: 195px; height: 37px; /* Specify width and height of the image. Height is value of each individual button graphic */
background-image: url(theImages/active.png); /* Add the image as a background */
background-position: top; /* Set the position to the top */
text-align: center;
vertical-align: middle;
line-height: 37px; /* the same as your div height */
font-size: 13px;
font-weight: bold;
color: #FFFFFF;
}
.active:hover {
cursor: pointer;
}
.showTemp {
color: #1D2F9F;
padding: 30px;
text-align: left;
font-size: 13px;
font-family: Verdana, 'Source Sans Pro';
font-weight: plain;
}
.showTempH {
color: #1D2F9F;
padding: 30px;
text-align: left;
font-size: 13px;
font-family: Verdana, 'Source Sans Pro';
font-weight: plain;
display: none;
}
我的 HTML 代码:
<table border=1 cellPadding=0 cellSpacing=0 width=100%>
<tr>
<td width=33%><div class="active both">BOTH</div></td>
<td width=33%><div class="demo clinical">CLINICAL</div></td>
<td width=33%><div class="demo nonclinical">NON-CLINICAL</div></td>
</tr>
<tr>
<td>
<ul id="bth" class=showTemp>
<li>Mission Statement - Interfaith Medical Center</li>
<li>About Employee Health Services</li>
<li>National Patient Safety Goals</li>
</ul>
</td>
<td>
<ul id="cl" class=showTempH>
<li>Pain Assessment and Management</li>
<li>Medication Errors</li>
<li>Bioethic Consultation Process</li>
</ul>
</td>
<td>
<ul id="nc" class=showTempH>
<li>Emergency Management</li>
<li>Infection Control</li>
<li>The Environment of Care Program</li>
</ul>
</td>
</tr>
</table>
我要做的是取决于用户单击的按钮,该按钮具有 ACTIVE 类,其余两个将具有 DEMO 类。如何修改我现有的 jquery 脚本?
电流输出:电流输出部位