添加指向所选图像的链接

时间:2014-12-11 09:17:29

标签: jquery html css css3

在此代码中,我试图找到要更改的内容,以便每次选择预览时在每个图像中添加不同的链接。

http://www.webdesigncrowd.com/3d-card-previewer/

http://www.webdesigncrowd.com/demo/3d-card-previewer-9.29.14/

      <div class="container">
  <div class="card-container">
     <div class="card">
     <a href=""><img src="img/interstellar.jpg"></a>
     </div>
     </div>
  <div class="card-container">
    <div class="card">
    <a href=""><img src="img/imitation_game.jpg"></a>
    </div>
  </div>
    <div class="card-container">
    <div class="card">
    <a href=""><img src="img/hobbit.jpg"></a>
    </div>
   </div>
  <div class="card-container">
<div class="card">
     <a href=""><img src="img/boxtrolls.jpg"></a>
    </div>
  </div>
    <div class="card-container active">
     <div class="card">
    <a href=""><img src="img/maze_runner.jpg"></a>
   </div>
   </div>
  <div class="clearfix"></div>
 </div>

1 个答案:

答案 0 :(得分:0)

试试这个:

$('div.card > a').click(function() {
    $(this).find('img').attr('src', 'the/new/path/to/preview');
    // ....
});