jquery簡單導航功能

來源:互聯網
上載者:User

<style type="text/css">
td
{
    background-color:#eee;
    width:50px;
    height:50px;
    }
</style>
    <title></title>
    <script src="jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        var count1 = 1;
        var count2 = 1;
        $(function () {
            $('a:eq(0)').click(function () {
                if (count1 % 2 != 0)
                {

                    $('td').hide(2000);
                    $('tr:last-child').hide(2000);
                    //顯示展開
                    $('a:eq(0)').text('展開');
                }
                else //if($('td').is(':visible'))
                {
                    $('td').show(2000);
                    $('tr:last-child').show(2000);
                    //顯示展開
                    $('a:eq(0)').text('掛起');
                }
                count1++;
            })
            $('a:eq(1)').click(function () {

                if (count2 % 2 != 0) {

                    $('tr:eq(2)').hide(2000);
                    $('tr:eq(3)').hide(2000);
                    //顯示展開
                    $('a:eq(1)').text('更多');
                }
                else {
                    $('tr:eq(2)').show(2000);
                    $('tr:eq(3)').show(2000);
                    //顯示展開
                    $('a:eq(1)').text('簡化');
                }


                count2++;
            })
        })
    </script>
</head>
<body>
<table>
<tbody>
<tr ><th colspan="2"><strong>新聞分類</strong></th><th></th><th id="gorzh"><a href="#" >掛起</a></th></tr>
<tr ><td>娛樂</td><td>體育</td><td>時尚</td><td>汽車</td></tr>
<tr><td>遊戲</td><td>音樂</td><td>小說</td><td>網購</td></tr>
<tr><td>IT</td><td>旅遊</td><td></td><td></td></tr>
<tr><th></th><th></th><th></th><th id="jhlan"><a href="#" >簡化</a></th></tr>
</tbody>
</table>
</body>
</html>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.