我有一个轮播,当单击图像时,我想获取图像的来源并在页面上的另一个 div 中打开它,“大图像”
$('.gallery-viewport-ext ul li a img').on('click', function () {
alert($(this).parent('a').attr('src');)
return false;
});
我一开始只是想提醒 src 我确定我一定做错了什么?
<div id="tabs1-ext">
<section class="gallery-viewport-ext">
<ul>
<li><a href="_includes/images/slide-1.jpg"><img src="_includes/images/slide-1.jpg" alt="image" /></a></li>
<li><a href="_includes/images/slide-2.jpg"><img src="_includes/images/slide-2.jpg" alt="image" /></a></li>
<li><a href="_includes/images/slide-3.jpg"><img src="_includes/images/slide-3.jpg" alt="image" /></a></li>
<li><a href="_includes/images/slide-1.jpg"><img src="_includes/images/slide-1.jpg" alt="image" /></a></li>
<li><a href="_includes/images/slide-2.jpg"><img src="_includes/images/slide-2.jpg" alt="image" /></a></li>
<li><a href="_includes/images/slide-3.jpg"><img src="_includes/images/slide-3.jpg" alt="image" /></a></li>
</ul>
<a id="simplePrevious"><img src="_includes/images/larr.png" alt="Left Arrow" /></a>
<a id="simpleNext"><img src="_includes/images/rarr.png" alt="Right Arrow" /></a>
</section>
<div class="big-image"><</div>
我是 jQuery 新手,所以请原谅我的天真!