您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jQuery简单实现网页选项卡特效_jquery

2026/2/16 5:59:43发布17次查看
css:
复制代码 代码如下:
.clear{clear:both; height:0px; overflow:hidden;}
        .tab{width:400px; font-size:12px;}
        .tab_menu ul{padding:0px;margin:0px;}
        .tab_menu li{list-style:none; display:block; float:left;
            background:#c2cefe; height:22px; line-height:22px;
            padding: 0px 8px; margin-right:6px; border:#86b4ca 1px solid;
        }
        .box{width:400px; height:200px; overflow:hidden; border:#a8c9d9 1px solid; padding:10px 8px; }
        .tab_menu ul li.selected{background:#dadada; cursor:pointer; }
        .hide{display:none;}
jquery:
复制代码 代码如下:
$(function() {
            var $menu_li = $(div.tab_menu ul li);  //选取网页选项卡
            $menu_li.click(function(){
                $(this).addclass(selected) //当前高亮
                        .siblings().removeclass(selected); //去掉其它同辈的高亮
                var index = $menu_li.index( $(this) ); //找到子节点的索引
                $(div.tab_box > div).eq(index).show() //索引为n的div显示出来
                        .siblings().hide();            //其它的选项卡隐藏
            })
        })
html:
复制代码 代码如下:
个人信息
            我的照片
            我的博客
我的qq:123456
hi
hello
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product