こんにちはみんな私は次のスクリプトを持っています:
$(document).ready(function () {
$('.shoppers-images ul li').click(function () {
$('.shoppers-images ul li').removeClass('selected');
$(this).addClass('selected');
});
});
これは私が望むように機能します...しかし、宣言された値を上書きしているため、cssが間違っていると確信しています..selectedクラスは決して表示されません
#foot-transport{
background: url(../img/css/register-runner.png) no-repeat;
background-position: center center;
margin-right: 20px;
}
#bicycle-transport{
background: url(../img/css/register-bycicle.png) no-repeat;
background-position: center center;
}
#van-transport{
background: url(../img/css/register-van.png) no-repeat;
background-position: center center;
margin-left: 20px;
}
.selected{
background: url(../img/css/checked-image.png) no-repeat;
background-position: center center;
}
これは私のhtmlです:
<div class="span7 shoppers-images">
<ul>
<a href="#"><li id="foot-transport"><span>Individual</span></li></a>
<a href="#"><li id="bicycle-transport"><span>Pro Driver/Courier</span></li></a>
<a href="#"><li id="van-transport"><span>A Delivery </span></li></a>
</ul>
</div>
問題は、「選択した」クラスをcssで宣言して、より強くするにはどうすればよいですか?