我做导航功能,将导航默认图像更改为悬停图像。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