我正在运行代码,我需要切换一个类,但它不起作用。我希望点击一个元素emailmodels
,添加类pinkthumb
,再次点击它就会被删除。
当我致电addclass()
时,它正在添加课程pinkthumb
,但是当我致电toggleClass()
时,它无效。
$(".emailmodels").click(function() {
$(this).toggleClass("pinkthumb");
});
.pinkthumb {
background: #f14d76 !important;
color: white !important;
}
@foreach($modeldetail->photos as $photo)
<li class="col-lg-2 col-sm-2 col-md-2 xyz allphotos photocat_{{$photo->photocategory_id}} ">
<input type="hidden" value="{{$photo->id}}">
<a href="#myphotoModal" class="thumbnail modelphotos makedisplaypicturediv emailmodels">
<img src="{{$photo->thumb}}" alt="{{$photo->filename}}">
<input type="checkbox" class="photoids dispnone" value="{{$photo->id}}">
</a>
<a class="group1 colorboxcat_{{$photo->photocategory_id}} dispnone" href="{{$photo->px640}}" title="{{$modeldetail->user->name}}">Grouped Photo 1</a>
<input type="hidden" value="{{$modeldetail->id}}">
<input type="radio" value="{{$photo->id}}" {{($photo->featured=='1')?'checked':null}} name="model_pic_featured" class="model_pic_featured"/><span>Make display picture</span>
</li>