简体   繁体   English

单击图像时如何在另一个Div中显示相关内容

[英]How to Show the Related Content in another Div when an Image Clicked

I have a div area (for main slider. But there will not be sliding inside). 我有一个div区域(用于主滑块。但是内部不会滑动)。 And under this div area there is a tab system. 在这个div区域下有一个选项卡系统。

In these tabs there are 1-6 images (In each tab there are another images (1 to 6 images) 在这些选项卡中有1-6张图像(每个选项卡中还有另一张图像(1至6张图像)

When I click one of these images I want to show the related content / photo etc in this Div area above. 当我单击这些图像之一时,我想在上面的该Div区域中显示相关的内容/照片等。

How can I do that? 我怎样才能做到这一点? Any example? 有什么例子吗? Any clue? 有什么线索吗?

I tried to use jquery for show/hide, toggle etc but for example I couldnt find how to keep those big divs unvisible within my html (I tried css "display:none;" but that didn't seem to me wise enough) and call them in its place (above of the tab system) 我尝试使用jquery进行显示/隐藏,切换等操作,但是例如,我找不到如何在html内保持那些大div不可见的方式(我尝试使用css“ display:none;”,但在我看来这还不够明智),并且在其位置调用它们(在选项卡系统上方)

PS: when an image is shown the others must be hidden. PS:显示图像时,其他图像必须隐藏。

Here you are demyr obviously you will have to modify to your exact needs: 在这里,您显然是demyr,您将不得不根据自己的实际需求进行修改:

http://jsfiddle.net/S4LGr/1/ http://jsfiddle.net/S4LGr/1/

It is no problem here is the updated code, edit as you need you should really be able to take it from here: 没问题,这里是更新的代码,根据需要进行编辑,您应该真正可以从这里获取它:

http://jsfiddle.net/S4LGr/3/ http://jsfiddle.net/S4LGr/3/

I changed the images on this one so you can actuall see it happen, very similiar to ford.ca: 我更改了这张图片,以便您可以实际看到它的发生,与ford.ca非常相似:

http://jsfiddle.net/S4LGr/5/ http://jsfiddle.net/S4LGr/5/

Here you go man all the pieces brought together: 在这里,您可以将所有碎片汇集在一起​​:

http://jsfiddle.net/S4LGr/9/ http://jsfiddle.net/S4LGr/9/

totallyFeelLikeIdidYourHomeWork lol you owe me a beer! totallyFeelLikeIdidYourHomeWork大声笑,您欠我一杯啤酒!

you can bind a function on all images/text that loads the relevant images/text to the detail div. 您可以在所有图像/文本上绑定功能,以将相关图像/文本加载到详细信息div。 Like this fiddle: http://jsfiddle.net/9jc46/ 像这样的小提琴: http : //jsfiddle.net/9jc46/

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

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