1
오버레이 + 갤러리 플러그인 작업 중입니다. 그러나 나는 한 지점에 머물러있다. 현재 코드는 #main div에있는 모든 URL 주소를 새 주소 (wrap.find ("a"). attr ("href", url);)로 바꿉니다. 그러나 나는 그것이 첫 번째 것을 대체하기를 원한다. 제발 조언을 부탁드립니다. 나는 그 질문이 분명하기를 희망한다.image onload는 첫 번째 URL 만 변경합니다.
<div id="main">
<a href="http://www.capalbosonline.com/images/634-large.jpg" title="Fairfax Gift Basket"><img src="http://www.capalbosonline.com/images/634-large.jpg" alt="Fairfax Gift Basket" id="productimage" /></a>
<a href="http://www.refinethetaste.com/html/media/images/2571243744_f1c6b487ff.jpg" title="Fairfax Gift Basket" ><img id="productimage" alt="Fairfax Gift Basket" src="http://www.refinethetaste.com/html/media/images/2571243744_f1c6b487ff.jpg"/></a>
</div>
$(".productthumbs img").click(function() {
// calclulate large image's URL based on the thumbnail URL (flickr specific)
var url = $(this).attr("src");
// get handle to element that wraps the image and make it semitransparent
var wrap = $("#main").fadeTo("medium", 0.5);
// the large image from flickr
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", url);
wrap.find("a").attr("href", url);
};
// begin loading the image from flickr
img.src = url;
// when page loads simulate a "click" on the first image
}).filter(":first").click();
너무 감사합니다! –