我帶了幾個JQuery教程並研究了一個縮略圖懸停交換圖像函數。最終我能夠將其納入我的客戶網站,它的工作!但是,當我懸停時,主圖像沒有返回到原始圖像。JQuery懸停交換圖像 - 未返回原始圖像
這裏是我的JQuery:
function myFunction(){
jQuery('#thumbs img').hover(function(){
jQuery('#largeImage').attr('src',jQuery(this).attr('src').replace('thumb','large'));
});
}
jQuery(document).ready(function(){
jQuery(myFunction);
});
我的主圖像是以ID = largeImage
我的縮略圖被包裹在id爲一個div =大拇指
在此處,這是工作只是網頁除了返回到原始圖像: http://test.pillarsoflifebook.com/tables/tabletops/wood/solid-plank-oak/solid-plank-oak/
我似乎無法弄清楚如何合併.hover的mouseout回調函數。我想我會將largeimg src設置爲一個變量,並將其替換爲mouseout函數。
任何意見非常感謝!謝謝!
我勸你不要用這種方法。這是舊的和低效率的。請嘗試使用CSS:懸停選擇器,svg資產和CSS3轉換。 – 0xcaff