嗨,我想打在有階級的「.block儲液標籤」的所有元素的功能循環,並做到以下幾點:通過元素
$(function(){
function cssTabs(){
var firstTab = $(".block-header-tabs").find("a:first");
var firstBlock = $(".block-header-tabs").find("a:first").attr('href');
$(firstBlock).parent().css({position: "relative"});
$(firstBlock).css({position: "absolute", zIndex: "2"})
$(firstBlock).siblings().css({opacity: "0", position: "absolute", top: "0", zIndex: "1"});
$(firstTab).addClass("tab-current");
$(firstTab).siblings().addClass("tab-noncurrent");
}
cssTabs();
$(".block-header-tabs a").click(function(){
$(this).siblings().removeClass("tab-current").addClass("tab-noncurrent");
$(this).removeClass("tab-noncurrent").addClass("tab-current")
var clickedTab = $(this).attr('href');
$(clickedTab).siblings().css({zIndex: "1"}).stop(0,0).animate({opacity:"0"}, function(){
$(clickedTab).siblings().css({display:"none"});
});
$(clickedTab).css({display:"block", zIndex:"2"}).stop(0,0).animate({opacity:"1"});
return false;
});
});
這裏是生活的鏈接例如,所以你可以檢查出來自己:) http://dl.dropbox.com/u/2878602/moviezet/index.html
感謝
你的問題是什麼? – Reigel 2010-09-23 06:55:42
通過解釋鏈接的方式,您可以看到該函數僅適用於.block-header-tabs的第一個實例,而不是第二個實例的右下方。它不是樣式,因爲它應該是:( – Fez 2010-09-23 06:56:11
我的問題是,我希望該功能重複,以便它爲所有元素的樣式,目前它只在第一個實例.block-header-tabs – Fez 2010-09-23 07:06:08