jQuery 드 롭 다운 메뉴 팝 업 을 누 르 는 작은 예


<title> ―― </title>
    <style type="text/css">
.navgation{margin:0;padding:0;list-style-type:none;position:relative;}
.navgation li {float:left;}
.navgation a{padding:3px 6px;background-color:orange;color:white;text-decoration:none;float:left;height:24px;}
.navgation a:hover {background-color:white;color:blue;text-decoration:underline;}
.navgation div{display:none;position:absolute;top:30px;}
</style>
    <script src="Jquery1.7.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".navgation input").each(function () {
                var this_div = $(".navgation div");
                var _inx = $(".navgation input").index(this);
                $(this).click(
                function () { this_div.eq(_inx).slideToggle(); },
                function () { this_div.eq(_inx).slideToggle(); }
           );
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ul class="navgation">
            <li><input type="button" id="button" value=" 1"/>
            <div> 1</div>
            </li>
            <li><input type="button" id="button1" value=" 2"/>
            <div> 2</div>
            </li>
            <li><input type="button" id="button2" value=" 3"/>
            <div> 3</div>
            </li>
            <li><input type="button" id="button3" value=" 4"/>
            <div> 4</div>
            </li>
            <li><input type="button" id="button4" value=" 5"/>
            <div> 5</div>
            </li>
        </ul>
    </div>
    </form>
</body>

좋은 웹페이지 즐겨찾기