zoukankan      html  css  js  c++  java
  • jQuery+Div Simple menu

    let's look at the sample first:

    here is the code, as it is so simple, there is no more comment. any questions, please feel free to leave a message to me:

     <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        
    <title></title>
       
    <script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" 

    type
    ="text/javascript"></script>

        
    <script>
        $(document).ready(
    function () {
        $(
    ".parent").next().hide();
        $(
    ".parent").toggle(function () {
            $(
    this).next().show("50");
            $(
    this).removeClass("parent").addClass("minus");
        }, 
    function () {
            $(
    this).next().hide("50");
            $(
    this).removeClass("minus").addClass("parent");
        }
        );
    });
    </script>
        
    <style>
    body
    {
         font-size
    :12px;
    }
    div
    {
         padding-left
    :10px;
    }
    .parent
    {
        background-image
    :url("plus.gif");
         padding-left
    :15px;
         background-position
    :center left;
         background-repeat
    :no-repeat;
         cursor
    :pointer;
    }
    .parent:hover
    {
         padding-left
    :18px;
    }
    .minus
    {
        background-image
    :url("minus.gif");
        padding-left
    :15px;
        background-repeat
    :no-repeat;
         background-position
    :center left;
    }

        
    </style>
    </head>
    <body>
    <div id="menu">
        
    <div class="parent">国内网站</div>
        
    <div>
            
    <div>新浪</div>
            
    <div>搜狐</div>
            
    <div>网易</div>
            
    <div class="parent">国内知名站点</div>
            
    <div>
                
    <div>博客园</div>
                
    <div>韩现龙的博客</div>
            
    </div>
        
    </div>
         
    <div class="parent">国外站点</div>
        
    <div>
            
    <div>白宫</div>
            
    <div class="parent">国外政府网站</div>
            
    <div>
                
    <div>美国网站</div>
                
    <div>北美网站</div>
            
    </div>
            
    <div>伊拉克</div>
            
    <div>英国BBC</div>
        
    </div>
    </div>
    </body>
    </html>
  • 相关阅读:
    Leetcode Word Pattern
    Leetcode Strobogrammatic Number
    Leetcode Meeting Rooms
    Leetcode Pascal's Triangle II
    Leetcode Pascal's Triangle
    Leetcode Majority Element II
    Leetcode Majority Element
    牛客多校第六场 B Shorten IPv6 Address 模拟
    牛客多校第六场 A Garbage 模拟/签到
    排列数,康托展开及其线段树优化
  • 原文地址:https://www.cnblogs.com/hanxianlong/p/1748646.html
Copyright © 2011-2022 走看看