1
サムネイルの置き換えソリューションがあります。imgアイテムの周りにaタグを追加する必要がありますが、同じ機能があります。jQuery thumbnail replaceメソッド(タグを追加するソリューションが必要)
jQueryの
$(".large").click(function() {
var thumbRel = $(this).attr("rel");
$(this).effect("transfer", { to: $(".thumbnail img[rel='" + thumbRel + "']") }, 1000);
});
$(".thumb").click(function() {
$(".thumbnail [class^='thumb']").removeClass("current");
$(this).addClass("current");
$(".large").attr("rel", $(this).attr("rel"));
$(this).effect("transfer", { to: $(".large") }, 1000);
$(".large").animate({ opacity: 1 }, 1000);
$(this).queue(function() {
$(".large").attr("src", $(this).attr("src").replace("-thumb", ""));
$(".large").animate({ opacity: 1 }, 1000);
$(this).dequeue();
});
});
画像はクリック可能である全体のdivを持つように、されたマークアップは、ドットネットと混合されるが、ここでは
<div class="product_images">
<div class="mainImage">
<a class="ShowProductImageDlg" href="#" onclick="ProductImagesDlgClientSide.showDialog('@Model.ProductToDisplay.Product.UrlSlug', 'Bottle'); return false;" >
<img class="LargeImage" src="@Model.ProductToDisplay.Product.awsImageUrlLarge" alt="@Model.ProductToDisplay.Product.ProductName" />
</a>
</div>
<strong>Additional Images</strong>
<div class="thumbnail">
<ul>
<li><a href=""><img class="SmallImage Bottle" src="@Model.ProductToDisplay.Product.awsImageUrlSmall"
alt="@Model.ProductToDisplay.Product.ProductName" /></a></li>
<li><a href=""><img class="SmallImage BackLabel" src="@Model.ProductToDisplay.ProductAdditionalImageUrlSmall(awsProductImageType.BackLabel)"
alt="@Model.ProductToDisplay.Product.ProductName" /></a></li>
</ul>
</div>
</div>
最終目標であります(それは90pxで90pxです)画像自体が80x35である場合。
同じjQueryを使用したいと思います。
申し訳ありません、 私はdisplay:blockを要素に置いて、ボックス全体をクリック可能にすることができます。が必要です。 (90x90px)、画像は80x35です。 どこにでもサムネイルをリンクさせたくありません。 – rizzy
'display:block;を適用するだけです。カーソル:ポインタ;を画像に追加し、それらにパディングを追加します。プレゼンテーション以外の目的でラッピングするための要素を作成することは何の意味もありません。 –
@ rc89: ''タグをクリックすると画像を囲む必要はなく、 'display:block;'を適用する必要はありません。ポインタを変更することさえできます。あなたのアイデアを考える上で良い時期だと思います。 – Tadeck