【发布时间】:2013-11-18 03:45:22
【问题描述】:
我想在悬停时更改我的图像,然后当我单击悬停的图像时,我会将其更改为另一个图像.. 但是,问题是当我单击悬停图像时,它将保留悬停图像而不是将其更改为单击图像..
我的项目里面有两个文件comp-profile.html和about.html,下面是源码:
comp-profile.html:
$("#Content-header-wrapper #link1").unbind("hover").hover(function(){
alert("asd");
$("#Content-header-wrapper #link1").attr("src","Images/Content/link-about-hover.png");
},function(){
$("#Content-header-wrapper #link1").attr("src","Images/Content/link-about.png");
});
$("#Content-header-wrapper #link1").unbind("click").click(function(){
$("#Content-header-wrapper #link1").attr("src","Images/Content/link-comp-profile.png");
$("#Content-header-wrapper #link2").attr("src","Images/Content/link-contact.png");
$("#Content-header-wrapper #link1").attr("alt","link-comp-profile");
$("#Content-header-wrapper #link2").attr("alt","link-contact");
$("#Content-header").html("<img src='Images/Content/header-about.png' alt='header-about' width='273px' height='41'/>");
$("#Content-fill").empty();
$("#Content-fill").load("about-content.html");
$("#Content").fadeOut(0);
$("#Content").animate({opacity: 'toggle', height: 'toggle'},"slow");
});
关于.html:
$("#Content-header-wrapper #link1").unbind("hover").hover(function(){
$("#Content-header-wrapper #link1").attr("src","Images/Content/link-comp-profile-hover.png");
},function(){
$("#Content-header-wrapper #link1").attr("src","Images/Content/link-comp-profile.png");
});
另一个奇怪的想法是,每当我将图像悬停在 about.html 中时,它仍然会提醒“asd”...
请帮帮我.. ^^
【问题讨论】:
标签: javascript jquery html image load