私は実際にJavascriptでコーディングする方法を知りません。 Airconsoleの場合、私はコントローラーを作成する必要があります。なぜなら私は私たちのチームでCSSとHTMLを使用できる唯一のチームだからです。Jquery toggleActiveは機能しません
ここでは、押されたときに色を変えるボタンを作成したかったのですが、その色のままです。 よく試しましたが、動作させる方法を理解できません。あなたが私を助けることを願っています。
マイHTML:ここ
<div id="characterScreen_readyButton" class="characterScreen_center" ontouchend="sendReady();" ontouchend="sendReady();">
<div class="readyButton">
</div>
</div>
私のCSS:
.readyButton{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
background: url("images/readyButton.png") no-repeat center;
background-size: contain;
}
.readyButton.active {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
background: url("images/readyButtonP.png") no-repeat center;
background-size: contain;
}
そして、私はjavascript:
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.js" >
$('.readyButton').click(function(){
if($(this).hasClass('active')){
$(this).removeClass('active')
} else {
$(this).addClass('active')
}
});
</script>
これはどのように問題を解決しますか?それでも動作するはずです。 – Sablefoste
@Sablefoste最初の問題は '
変更:
出典
2017-10-10 12:29:07 Ehsan