我想要这种效果的,有没有具体的代码和具体的解析,我用的是VS2010的asp.net

2025-02-26 00:15:19
推荐回答(2个)
回答1:

那就是一个简单的tab效果的啊

下面是一个demo,把引用的jquery换成你的路径

        "http://www.w3.org/TR/html4/loose.dtd">


    Tab Demo
    
    
        *{ margin: 0; padding: 0;}
        .container{ width: 1000px; height: auto;  margin: 0 auto; border: 1px solid #4e4e4e;}
        .tab-head{ width: 100%; height: 50px;border-bottom: 1px solid #4e4e4e; }
        .tab-head ul{ width: 100%; height: 50px; list-style: none;}
        .tab-head ul .normal-li{ width: 150px; height: 50px;  float: left; line-height: 50px; text-align: center; font-family: "Microsoft YaHei"; font-weight: bold; font-size: 20px; background-color: #fff; color: #111; cursor: pointer;}
        .tab-head ul .selected-li{ width: 150px; height: 50px;  float: left; line-height: 50px; text-align: center; font-family: "Microsoft YaHei"; font-weight: bold; font-size: 20px; background-color: #111; color: #fff;}
        .tab-content{ width: 100%; height: auto;}
        .tab-content ul{ width:100%; height: auto; list-style: none;}
        .tab-content ul li{ width:100%; height: 500px; display:none; }
    
    
    
        var currentIndex=0;
        $(document).ready(function(){
            $(".tab-head ul li").click(function(){
                var index=$(this).index();
                if(currentIndex!=index) {
                    currentIndex=index;
                    $(this).removeClass("normal-li").addClass("selected-li");
                    $(this).siblings().removeClass("selected-li").addClass("normal-li");
                    var contents=$(".tab-content").find("li");
                    $(contents[index]).show();
                    $(contents[index]).siblings().hide();
                }
            });
        });
    


    
          
                

                        导航
                        推荐
                        购物
                        视频
                    

          

          
                

                        导航
                        推荐
                        购物
                        视频
                    

          

    


回答2:

找个前端框架支持tab效果就行了,比如dwz,jquery ui什么的

相关问答
最新问答