简体   繁体   English

选择另一个图像时,jQuery隐藏标题-包括jsFiddle

[英]Jquery hide caption when selecting another image - jsFiddle included

http://jsfiddle.net/Pctgb/1/ http://jsfiddle.net/Pctgb/1/

In the fiddle when I click one of the images the caption appears (bottom), and when I click the image again the caption disappears (like expected) HOWEVER if I skip clicking the same image again and actually go ahead and click another image the caption in the old image stays. 在小提琴中,当我单击其中一幅图像时,标题出现(底部),而当我再次单击图像时,标题消失(如预期的那样),但是,如果我再次跳过同一图像并继续前进并单击另一幅图像,标题在旧的形象停留。

Where should I look if I want the caption to be only displayed in the expanded image. 如果希望字幕显示在展开的图像中,应该在哪里查看。

Thank you all 谢谢你们

In your image click handler you can do this: 在图像点击处理程序中,您可以执行以下操作:

$('.caption').each(function(){
    $(this).hide();          
});

Forked: http://jsfiddle.net/DQHgg/ 分叉: http : //jsfiddle.net/DQHgg/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM