手写导航栏切换页面

在这里插入图片描述

<style>
    .container {
        width: 100%;
        letter-spacing: 1px;
    }
    .navBox{
        width: 1200px;
        margin: 0 auto;
        padding: 70px;
        box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.25);
        border: 1px solid #ddd;
        display:none;
    }
    .navItem0 {
        display:block;
    }
    .left {
        float: left;
    }
    .toggleBox {
        width: 100%;
    }
    .toggleBox div {
        padding: 0 20px;
        text-align: center;
        cursor: pointer;
        height: 47px;
        line-height: 47px;
        font-weight: bold;
    }
    .navItem {
        border-right: 1px solid #ddd;
        color: #666;
        border-bottom: 2px solid #ccc;
        background: linear-gradient(0deg, #FEFEFE, #FEFEFE);
        box-shadow: 2px 1px 5px rgba(0, 0, 0, 0.15);
    }
    .activeCur {
        padding: 0 30px !important;
        color: #F61067;
        border: 1px solid #F61067;
        border-bottom: 2px solid #F61067;
    }
</style>

<div class="container">
    <div style="width:1340px;height:50px;margin:0 auto;">
        <div class="toggleBox left">
        </div>
    </div>
    <div class="containerBox">
    </div>

</div>
@Scripts.Render("http://libs.baidu.com/jquery/1.7.1/jquery.min.js")
<script>
    $(function () {
        var navList = ['音位习得评估记录表','声母音位习得评估分析表','音位对比能力评估记录表','音位对比能力评估分析表','声母音位对比和构音清晰度分析表'];
        var strHtml = '';
        var strContainer = '';
        $('.toggleBox').empty();
        $('.containerBox').empty();
        for (var i = 0; i < navList.length; i++) {
            strHtml += '<div curBox="navItem' + i + '"  class="left'
            if(i == 0){
             strHtml +=' activeCur '
            }
            strHtml += ' navItem">'
            strHtml += '<span>' + navList[i]+ '</span>'
            strHtml += '</div>'
            strContainer += '<div class="navBox navItem' + i + '">' + i + '</div>'
        }
        $('.toggleBox').append(strHtml)
        $('.containerBox').append(strContainer)
        $('.navItem').click(function () {
            $(this).siblings().removeClass('activeCur');
            $(this).addClass('activeCur');
            $('.' + $(this).attr('curBox')).show();
            $('.' + $(this).attr('curBox')).siblings().hide();
        })
    })
</script>
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值