JQuery切换图像CSS [英] JQuery toggle images CSS
问题描述
它可以工作并在点击时更改图像的css大小。
唯一的问题是,当我点击下一张图片时,前一张图片会保留
,并且新的css切换。
有没有办法,当我点击下一张图片时,上一张图片会回到原来的css
。
我在这里包含了一个jsfiddle示例:
http://jsfiddle.net / webdott / hSFpp /
以下是jquery代码:
$('img')。click(function(){
$(this).toggleClass('thumb fullview')
});
您可以看到您点击的每张图片都保持较大。
谢谢
检查这个小提琴。我解决了你的问题。请检查这个小提琴 http://jsfiddle.net/Resey/1/
$ b $(b) $('img')。click(function(){
$(this).toggleClass('fullview')。siblings() .removeClass('fullview');
});
I am using Jquery to change the css of some images.
It works and changes the image css size when clicked. The only issue is that when I click on the next image, the previous image stays with the new css toggle.
Is there a way that when I click on the next image, the previous image goes back to the original css.
I have included a jsfiddle example here: http://jsfiddle.net/webdott/hSFpp/
Here is the jquery code:
$('img').click(function() {
$(this).toggleClass('thumb fullview')
});
You can see that each image you click stays large.
Thanks
check this fiddle. I solved your issue. please check this fiddle http://jsfiddle.net/Resey/1/
$('img').click(function() {
$(this).toggleClass('fullview').siblings().removeClass('fullview');
});
这篇关于JQuery切换图像CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!