作者:幽咽小香 | 来源:互联网 | 2023-09-06 12:40
Icreatedthiscode,clickonapictureandyoullcomeoutthedescriptionbelowtheimage.Iwould
I created this code, click on a picture and you'll come out the description below the image. I would like to improve this code, so I want to be active only one description of a time, so if I click on a image see the description of that just clicked, and hide the last activated. maybe with the code is more clear http://codepen.io/mp1985/pen/qOrpQX
我创建了这段代码,点击图片然后你就可以看到图片下方的描述了。我想改进这个代码,所以我想只激活一个时间的描述,所以如果我点击一个图像,看到刚刚点击的描述,并隐藏最后激活的。也许用代码更清晰http://codepen.io/mp1985/pen/qOrpQX
$( ".spec").click(function() {
$(this).find(".image, .details-spec").toggle();
$(this).find(".block-content").toggleClass('white');
});
I tried with toggle(), toggleClass() and not() but without success. any idea? thanks
我尝试使用toggle(),toggleClass()而不是()但没有成功。任何想法?谢谢
3 个解决方案