简体   繁体   English

根据所选图像更改图像和描述

[英]Change image and description according to the selected image

Someone asked me to recreate this kind of thing, in the "Nos Service" part of this website: http://www.ohmygoodnesscafe.fr/ , there's a gallery of four images. 有人要求我在此网站的“ Nos Service”部分中重新创建这种内容: http : //www.ohmygoodnesscafe.fr/ ,其中包含四个图像库。 Under the gallery there's the selected image with text. 在图库下有选定的带有文字的图像。 When you click on a different picture, the content is changed accordingly, with the selected image and its description. 当您单击另一张图片时,内容会随之更改,其中包含所选的图像及其说明。 How can I achieve the same thing? 我怎样才能达成同一目标? Is there a plugin for this? 是否有插件?

 $('#tabs').on('click','li',function(e){ var tab = $(this).data('tab'); $('.pane.' + tab).addClass('active').siblings('.pane.active').removeClass('active'); }); 
 .pane { display:none; padding:20px; } .pane.active { display:block; } #tabs { display:table; margin:0; padding:0; } #tabs li { display:table-cell; background:blue; color:white; padding:10px; cursor:pointer; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul id="tabs"> <li data-tab="one">One</li> <li data-tab="two">Two</li> <li data-tab="three">Three</li> <li data-tab="four">Four</li> </ul> <div class="pane one active"> One data </div> <div class="pane two"> Two data </div> <div class="pane three"> Three data </div> <div class="pane four"> Four data </div> 

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

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