Sponsered Links
Categories
Sponsered Links

JQuery Simple Drop Down Menu

 

This is a simple JQuery Simple Drop Down Menu Example. This example demonstrates to create single-level drop down menu based on JQuery library.

Here is the screenshot of the example:

The complete source code is here:

 

 

<html>
<head>
    <title>JQuery Simple Drop Down Menu</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <style type="text/css">   
   
        body{   
            background: #FCFFED;
            padding: 0 20px}

        .clear{
            clear: both;
            overflow: hidden;
            height: 0}

        #all {
            width: 40%;
            min-width: 300px;
            margin: 40px auto 0 auto;
            background: #6595A3;
            padding: 20px 35px}

        h1{   
            font: 26px tahoma, arial;
            color: green}

        a {
            color: #324143}       
       
    </style>
   
</head>
<body>
<div id="all">

<h1>JQuery Simple Drop Down Menu</h1>
<p>Single-level Drop Down Menu based on jQuery library</p>

<style type="text/css">
    #jst{
        margin: 0;
        padding: 0
    }
    #jst li{
        float: left;
        list-style: none;
        font: 12px Tahoma, Arial
    }
    #jst li a{
        display: block;
        background: #324143;
        padding: 5px 12px;
        text-decoration: none;
        border-right: 1px solid white;
        width: 70px;
        color: #EAFFED;
        white-space: nowrap
    }
    #jst li a:hover{
        background: #24313C
    }
    #jst li ul{
        margin: 0;
        padding: 0;
        position: absolute;
        visibility: hidden;
        border-top: 1px solid white
    }
    #jst li ul li{
        float: none;
        display: inline
    }
    #jst li ul li a{
        width: auto;
        background: #A9C251;
        color: #24313C
    }
    #jst li ul li a:hover{
        background: #8EA344
    }
</style>

<script src="jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var timeout = 500;
    var closetimer = 0;
    var ddmenuitem = 0;

    function jst_open(){
        jst_canceltimer();
        jst_close();
        ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');
    }

    function jst_close(){
        if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
    }

    function jst_timer(){
        closetimer = window.setTimeout(jst_close, timeout);
    }

    function jst_canceltimer(){
        if(closetimer){
            window.clearTimeout(closetimer);
            closetimer = null;
        }
    }

    $(document).ready(function(){
        $('#jst > li').bind('mouseover', jst_open);
        $('#jst > li').bind('mouseout',  jst_timer);
    });

    document.onclick = jst_close;
</script>

<ul id="jst">
    <li><a href="#">JavaScript</a>
        <ul>
            <li><a href="#">Drop Down Menu</a></li>
            <li><a href="#">Drop Down List</a></li>
            <li><a href="#">JavaScript Navigation</a></li>
        </ul>
    </li>
    <li><a href="#">Jquery</a>
        <ul>
            <li><a href="#">Drop Down Menu</a></li>
            <li><a href="#">Drop Down List</a></li>
            <li><a href="#">Drop Down Item</a></li>
            <li><a href="#">Drop DownShadow</a></li>
            <li><a href="#">Jquery Navigation</a></li>
        </ul>
    </li>   
</ul>
<div class="clear"> </div>

</body>
</html>

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved