UPDATED: 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 (2 次ロールオーバー状態) を付けました。私の問題は、バラバラのロールオーバー、または二次ロールオーバーの円ボタンをターゲットにすることにあると思います。モックアップのリンクを参照してください。
次のモックアップは、まさにナビゲーションに必要なものです。 モックアップはこちら
更新: 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");
});
});