在画廊中,我想阻止某些缩略图通过灯箱扩展其原始图片。图像没有 ID,只有一个类。所有链接都是从数据库中的表中读取的。
$(document).ready(function(){
if($('.product-image').attr('target', 'blockedpath')) {
$('.product-image').click(function(e) {
e.preventDefault();
return false;
});
}
});
<li class="product">
<div class="productInfo">
<h3>@i.ToString()</h3>
<a href="@Href("~/Images/2013/" + i.ToString() + ".jpg")" rel="lightbox" class="link">
<img class="product-image" src="@Href("~/Images/2013/Thumbnails/" + i.ToString() + ".jpg")" alt="foto" />
</a>
</div>
</li>
如果我使用它,所有缩略图都会被阻止。如何防止仅被阻止的图片并避免阻止缩略图。是否有可能将所有应该被阻止的图像保存在一个数组中并循环遍历该数组以阻止这些缩略图?