首先感謝您花時間幫助我完成此任務。jquery顯示/隱藏多個div切換
對不起,我的英語;-)
好吧,我給你一個鏈接到我的項目會更容易理解我的問題
正如你可以在右側看到,你有社交小組。
我想用jquery打開每個面板(與最後一個提要)。在閱讀了一些帖子後,我能夠使其工作(我並不擅長jquery)。但我仍然有問題。
正如你可以注意到,當你點擊另一個按鈕(Facebook,YouTube的)面板關閉/打開等等,但按鈕本身保持活動的位置。它不會回到他的正常位置。我把它認爲由於切換問題
CODE:
$(".link1").click(function(){
$("#twittercontent, #youtubehome").hide();
$("#pz_fbplugin").toggle("fast");
$(this).toggleClass("active");
return false;
$(".link2, .link3").removeClass('active');
$(".link1").addClass("active");
});
$(".link2").click(function(){
$("#pz_fbplugin, #youtubehome").hide();
$("#twittercontent").toggle("fast");
$(this).toggleClass("active");
return false;
$(".link1, .link3").removeClass("active");
$(".link2").addClass("active");
});
$(".link3").click(function(){
$("#pz_fbplugin, #twittercontent").hide();
$("#youtubehome").toggle("fast");
$(this).toggleClass("active");
return false;
$(".link1, .link2").removeClass("active");
$(".link3").addClass("active");
});
CSS:
a.facebook {width: 46px;position: fixed; right:0; height: 130px; top: 175px; margin-right: 0; background: url("socialrudyfacebook.png")no-repeat; z-index:51}
a.facebook:hover{width: 129px}
a.active.facebook{width: 129px}
a.twitter{width: 46px; position: fixed; height: 130px;right: 0; top: 317px; margin-right: 0;z-index: 51;background: url("socialrudytwitter.png")no-repeat; a-index:51}
a.twitter:hover{ width: 129px}
a.active.twitter{ width: 129px}
a.youtube{width: 46px;position: fixed; height: 130px; right: 0; top: 457px ;z-index: 150; background: url("socialrudyyoutube")no-repeat; a-index:51}
a.youtube:hover{ width: 129px}
a.active.youtube{ width: 129px}
希望這enaugh你來幫我這。
在所有情況下,您都有'return false;'在操作類之前,所以這些更改不會被執行。 –