更新:06.29.10 这是我目前使用的代码。在搜索 Jquery 文档后,我真的很接近。
$(document).ready(function(){
//Rollovers for circle buttons
$('img').hover(
function(){
this.src = this.src.replace("_org","_over");
},
function(){
this.src = this.src.replace("_over","_org");
});
//Disjointed rollover - on hover make circles use secondary hover (over2)
$(".genBtn80").hover(
function(){
$(".gen80circle").src = $(".gen80circle").src.replace("_org","_over2");
},
function(){
$(".gen80circle").src = $(".gen80circle").src.replace("_over2","_org");
});
});
所以我有关于翻转的一切工作。我的图像后缀为 _org(用于正常状态)、_over(第一次翻转状态)和 _over2(用于二次翻转状态)。我想我的问题现在在于针对脱节翻转或二次翻转的圆形按钮。请查看样机链接。
下面的模型正是我导航所需要的。 点击此处查看样机
更新:06.30.10 现在工作!!! 不过,我不能发布多个链接...啊!我会用测试链接发表评论。
我很好奇如何使用数组和循环来简化这一点,但我不想打扰。我也很困惑为什么上面的代码从来没有工作过。似乎我选择了正确的元素,但 src 从未改变。我确定我做错了什么,但我是来学习的。:)
$(document).ready(function(){
//Rollovers for circle buttons
$(".circleBtn").hover(
function(){
this.src = this.src.replace("_org","_over");
},
function(){
this.src = this.src.replace("_over","_org");
});
//Rollovers for navigation buttons
$(".navBtn").hover(
function(){
this.src = this.src.replace("_org","_over");
},
function(){
this.src = this.src.replace("_over","_org");
});
//Disjointed rollovers - use secondary rollover for circle imgs
$(".genBtn80").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#janice_circle").attr("src", "images/janice_over2.gif");
$("#sugi_circle").attr("src", "images/sugi_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#janice_circle").attr("src", "images/janice_org.gif");
$("#sugi_circle").attr("src", "images/sugi_org.gif");
});
$(".genBtn70").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#hatsuko_circle").attr("src", "images/hatsuko_over2.gif");
$("#satoko_circle").attr("src", "images/satoko_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#hatsuko_circle").attr("src", "images/hatsuko_org.gif");
$("#satoko_circle").attr("src", "images/satoko_org.gif");
});
$(".genBtn60").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#noriko_circle").attr("src", "images/noriko_over2.gif");
$("#yuki_circle").attr("src", "images/yuki_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#noriko_circle").attr("src", "images/noriko_org.gif");
$("#yuki_circle").attr("src", "images/yuki_org.gif");
});
$(".genBtn50").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#ritsuko_circle").attr("src", "images/ritsuko_over2.gif");
$("#yuka_circle").attr("src", "images/yuka_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#ritsuko_circle").attr("src", "images/ritsuko_org.gif");
$("#yuka_circle").attr("src", "images/yuka_org.gif");
});
$(".genBtn40").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#christina_circle").attr("src", "images/christina_over2.gif");
$("#chiharu_circle").attr("src", "images/chiharu_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#christina_circle").attr("src", "images/christina_org.gif");
$("#chiharu_circle").attr("src", "images/chiharu_org.gif");
});
$(".genBtn30").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#haruko_circle").attr("src", "images/haruko_over2.gif");
$("#shiho_circle").attr("src", "images/shiho_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#haruko_circle").attr("src", "images/haruko_org.gif");
$("#shiho_circle").attr("src", "images/shiho_org.gif");
});
$(".genBtn20").hover(
function(){
this.src = this.src.replace("_org","_over");
$("#aoi_circle").attr("src", "images/aoi_over2.gif");
$("#tomoko_circle").attr("src", "images/tomoko_over2.gif");
$("#miho_circle").attr("src", "images/miho_over2.gif");
},
function(){
this.src = this.src.replace("_over","_org");
$("#aoi_circle").attr("src", "images/aoi_org.gif");
$("#tomoko_circle").attr("src", "images/tomoko_org.gif");
$("#miho_circle").attr("src", "images/miho_org.gif");
});
});