是否可以让图像的翻转触发多个图像的不同活动状态?
我想创建一个图像库,但是当单击一张图像时,其他图像将对单击的图像做出反应。
http://thegoodgirlsnyc.com/test/test.html#
我找不到现有的插件,我不知道从哪里开始。任何指示将不胜感激。
I would like to create a gallery of images but when one image is clicked on the other images will react to the one that is clicked.
http://thegoodgirlsnyc.com/test/test.html#
I'm failing to find an existing plugin, and I'm not sure where to start. Any pointers would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您在寻找这样的东西吗?如果您想要实现这一目标,您可以用图像替换背景颜色。
http://jsfiddle.net/k4t434sispho3nix/Eb9as/1/
Are you looking for something like this? You could substitue images for background colors if that's what you're trying to acheive.
http://jsfiddle.net/k4t434sispho3nix/Eb9as/1/
jQuery 非常适合于此。您可以在图像上设置一个单击侦听器(在父元素上设置一个单击侦听器可能会更好(如果我正确理解该术语,请查找延迟侦听器))。然后,您只需向除单击的图像之外的所有图像添加一个 css 类(如果存在,请确保从单击的图像中删除该类)。如果您需要对单击的图像进行特殊样式,请为其添加另一个独特的类。
之后,您可以使用 css 模板文件来设置不同元素的样式。
jQuery would lend itself excellently for this. You'd take a click listener on the images (One on the parent element might be better (Look for deferred listener if I get that term right)). Then you'd simply add a css class to all images except for the one clicked (Make sure you remove this class from the clicked image if it's there). If you need special styling on the clicked image, add another unique class to that.
After this you can just use a css template file to style the different elements.
根据您在原始帖子中所说的内容,我相信您需要这样的东西:
From what you said in the original post, I believe you'd need something like this: