jQueryトグルを作成しようとしています。再生&アイコンを一時停止します。アイコンonClickを切り替えたいと思います。jQueryトグルスイッチ - クリック時のアイコン?
注:
私のデモは、コード細かい作業が、私は機能のようなを探していますが...私は最初再生アイコンをクリックし、それが変更されます。私は2番目再生アイコンをクリックしたとき、それは最初一時停止アイコンが再生アイコンに変更されます一時停止アイコンで変化しますし、それは3番目のアイコンで繰り返されます。
デモコード:
$("#infoToggler").click(function() {
$(this).find('img').toggle();
});
$("#infoToggler2").click(function() {
$(this).find('img').toggle();
});
$("#infoToggler3").click(function() {
$(this).find('img').toggle();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="infoToggler"><img src="http://c28.imgup.net/play-icon223d.png" width="60px" height="60px"/>
<img src="http://e52.imgup.net/stop-icon731e.png" width="60px" height="60px" style="display:none"/>
</div>
<div id="infoToggler2"><img src="http://c28.imgup.net/play-icon223d.png
" width="60px" height="60px"/>
<img src="http://e52.imgup.net/stop-icon731e.png" width="60px" height="60px" style="display:none"/>
</div>
<div id="infoToggler3"><img src="http://c28.imgup.net/play-icon223d.png" width="60px" height="60px"/>
<img src="http://e52.imgup.net/stop-icon731e.png" width="60px" height="60px" style="display:none"/>
</div>
私は、スタックオーバーフローの上にこれらのリンクを発見したが、彼らは私が探しているものではありませんね。
jQuery Toggle on click of image
How to jQuery toggle multiple images on different button click?
私はウル質問 –
アンカーリンクABT不明で申し訳ありませんイムね? –
あなたが提供したコードはうまくいくようです.. –