2012-09-30 71 views
-1

我發現這個很酷的腳本,使圖像上的縮放(我想在我的博客上使用)但我想使用更多的圖片,而不僅僅是腳本上的圖片。所以我實際上想在mouseUp上替換這個腳本中的值。因此pic1,pic2,pic3等的按鈕必須替換「largeimage」和body。替換javascript值

希望有人能幫助我。

jQuery(document).ready(function($){ 

    $('#image2').addimagezoom({ 
     zoomrange: [2, 2], 
     magnifiersize: [460,430], 
     magnifierpos: 'right', 
     cursorshade: false, 
     cursorshadecolor: 'pink', 
     cursorshadeopacity: 0.3 , 
     cursorshadeborder: '1px solid white', 
     largeimage: 'http://www.rat-bikes.com/ratbikes/vanmoof-rotterdam.jpg' //<-- No comma after last option! 
    }) 

}) 
+0

使用其他屬性並使用該腳本並使其具有可伸縮性。 :) –

回答

1

不要這樣......讓所有用classalt值與大圖像的圖像。

<img src="thumb1.png" class="zoom" alt="full1.png" /> 
<img src="thumb2.png" class="zoom" alt="full2.png" /> 

現在在腳本中,附加的事件處理程序的所有.zoom並與altattr值的幫助下給大圖像的URL。

jQuery(document).ready(function($){ 
    $('.zoom').addimagezoom({ 
     zoomrange: [2, 2], 
     magnifiersize: [460,430], 
     magnifierpos: 'right', 
     cursorshade: false, 
     cursorshadecolor: 'pink', 
     cursorshadeopacity: 0.3 , 
     cursorshadeborder: '1px solid white', 
     largeimage: $(this).attr("alt") 
    }); 
});