这是地址 http://amu1433.gotoip2.com/tab.html<script>
$(function(){
//进入页面时
$(".tab_content").hide(); //候隐藏所有的content内容
$("ul.tabs li:first").addClass("active").show(); //激活第一个tab
$(".tab_content:first").show(); //显示第一个content内容
//点击对应的tab时
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //将所有的tab去掉active样式
$(this).addClass("active"); //点击的这个tab加active样式
$(".tab_content").hide(); //候隐藏所有的content内容
var activeTab = $(this).find("a").attr("href"); //找到要显示的ID
$(activeTab).fadeIn(); //淡出淡入显示
});
})
</script>问题是当我页面有2个或者N个的这样的切换是 就 不行了..
是不是要写个循环啊..
jquer不太懂 求教!!!参考地址 http://amu1433.gotoip2.com/tab.html
点击第二个切换的时候 第一个就影藏了..........
$(function(){
//进入页面时
$(".tab_content").hide(); //候隐藏所有的content内容
$("ul.tabs li:first").addClass("active").show(); //激活第一个tab
$(".tab_content:first").show(); //显示第一个content内容
//点击对应的tab时
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //将所有的tab去掉active样式
$(this).addClass("active"); //点击的这个tab加active样式
$(".tab_content").hide(); //候隐藏所有的content内容
var activeTab = $(this).find("a").attr("href"); //找到要显示的ID
$(activeTab).fadeIn(); //淡出淡入显示
});
})
</script>问题是当我页面有2个或者N个的这样的切换是 就 不行了..
是不是要写个循环啊..
jquer不太懂 求教!!!参考地址 http://amu1433.gotoip2.com/tab.html
点击第二个切换的时候 第一个就影藏了..........
//进入页面时
$(".tab_content").hide(); //候隐藏所有的content内容
$("ul.tabs li:first-child").addClass("active").show(); //激活第一个tab
$(".tab_content:first-child").show(); //显示第一个content内容
//点击对应的tab时
$("ul.tabs li").click(function(){
$("ul.tabs li").removeClass("active"); //将所有的tab去掉active样式
$(this).addClass("active"); //点击的这个tab加active样式
//$(".tab_content").hide(); //候隐藏所有的content内容
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn().siblings().hide(); //Fade in the active ID content
});
})
//进入页面时
$(".tab_content").hide(); //候隐藏所有的content内容
$("ul.tabs li:first-child").addClass("active").show(); //激活第一个tab
$(".tab_content:first-child").show(); //显示第一个content内容
//点击对应的tab时
$("ul.tabs li").click(function(){
//$("ul.tabs li").removeClass("active"); //将所有的tab去掉active样式
//$(this).addClass("active"); //点击的这个tab加active样式
//$(".tab_content").hide(); //候隐藏所有的content内容
$(this).addClass("active").siblings().removeClass("active");
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn().siblings().hide(); //Fade in the active ID content
});
});
呵呵