私はちょうどプロジェクトに取り組んでいます。今はちょっとした助けが必要です。クリックで変更するクラス
When the user enters the site they are gonna see this image
そして
on mouse over this is gonna show
ユーザーは、音楽が、今では正常に動作しなければならない再生ボタンをクリックします。しかし、それは再生ボタンの代わりに一時停止ボタンに変わるべきであり、また、画像は第2の画像と一時停止ボタンと一緒に留まるべきである。
<div class="pos-rlt">
<div class="bottom"> <span class="badge bg-info m-l-sm m-b-sm">04:08</span>
</div>
<div class="item-overlay opacity r r-2x bg-black">
<div class="text-info padder m-t-sm text-sm"> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star-o text-muted"></i>
</div>
<div class="center text-center m-t-n"> <a href="#"><i data-jp-src="songs/18.mp3" class="icon-control-play i-2x"></i></a>
</div>
<div class="bottom padder m-b-sm">
<a href="#" class="pull-right"> <i class="fa fa-heart-o"></i>
</a>
<a href="#"> <i class="fa fa-plus-circle"></i>
</a>
</div>
</div>
<a href="#">
<img src="images/p1.jpg" alt="" class="r r-2x img-full">
</a>
</div>
第1の画像のクラスがある:
item-overlay opacity r r-2x bg-black
及び第2の画像:
item-overlay opacity r r-2x bg-black active
と再生ボタンのクラスは
ありますclass="icon-control-play i-2x
と一時停止ボタンの私が欲しいもの
icon-control-pause i-2x text-active
で、ユーザーが再生ボタン class="icon-control-play i-2x
をクリックしたときです。再生クラスのボタンをicon-control-pause i-2x text-active
に変更し、画像のクラスitem-overlay opacity r r-2x bg-black
もitem-overlay opacity r r-2x bg-black active
に変更する必要があります。そして、ユーザーがそれを再びクリックすると、それは元に戻す必要があります。あなたはtoggleClassを持つクラスを切り替えることができますよろしく
ナイ
私はこのコード –
それをしようとしてくれてありがとう。以前に呼び出されたjqueryを持っている限り、スクリプトタグ内で使用することもできます。 –
を追加する必要があります。これは、既存のjqueryのコードのどこにでも正常に動作する必要があります –