我目前有class ="screenPower"
哪个驻留在里面class="screenItem"
。
screenItem
我有一个点击事件:
$(".screenItem").click(function() {
var clickedbutton = this;
}
我的问题是:单击时如何更改screenPower screenOff
为screenPower screenOn
?当screenOff
被点击时,当前活动screenOn
应该被关闭。- 换句话说 - 一次只能有一个屏幕screenOn
。
我基本上想做的是:
if(clicked && == "screenPower screenOff) {
//change target class to screenPower screenOn
//change current active class to screenPower screenOff
}
HTML
<div class="screenItem">
<div class="screenImage1"> <span></span>
<img src="images/img.gif" class="img-rounded img-responsive" alt="KSRasmussen" />
</div>
<div class="screenPower screenOn"></div>
</div>
<div class="screenItem">
<div class="screenImage1"> <span></span>
<img src="images/img.gif" class="img-rounded img-responsive" alt="KSRasmussen" />
</div>
<div class="screenPower screenOff"></div>
</div>