我做導航功能,將導航默認圖像更改爲懸停圖像。jquery .hover()導航
默認圖像名稱是「main.png」和懸停圖片是「main_hover.png」
我知道如何從HTML src屬性的jQuery的幫助下提取圖像的名字,但我倒知道如何添加額外的
$(document).ready(function(){
$(".nav").hover(function(){
var default_button = this.src;
// here is part where i need help with adding "_hover" to default_image
$(this).attr('src', default_button) // i know i need this after image is not hovered
});
});
我需要添加幾行,但thx求助! .replace()使這個工作成爲可能! :) – aainaarz