Simple Responsive Menu | Sanwebcorner

Simple Responsive Menu


Hi Today i am going to tell how to create a Simple Responsive Menu Using css3 media screen and jquery, Now a days all are doing Responsive website, That means to fix all the contents in all the screens like tab and mobile and desktop, laptop.

Now a days Lot of people using internet through Mobile and Tabs , So that only the Responsive concept has been implemented.

The Responsive Templates helps the customers to access the contents very easily because the contents and website are fixed the the particular screen no need to scroll left and right. so that the menu is very important to website so we will see how to create simple responsive menu using css and jquery.

Now we can see how to create Responsive Menu Using Jquery and css media screen

Responsive Design view press ctrl+Shift+M in Mozilla Firefox.





index.html

<!doctype html>
<html lang=''>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="script.js"></script>
<title>simple responsive menu | san web corner</title>
</head>
<body>
<div class="san">
<div id='sanmenu'>
<ul>
<li class='active'><a href='#'><span>About</span></a></li>
<li><a href='#'><span>Partners</span></a></li>
<li><a href='#'><span>Career</span></a>  </li>
<li><a href='#'><span>Location</span></a></li>
<li class='last'><a href='#'><span>News</span></a></li>
<li class='last'><a href='#'><span>Welbeing</span></a></li>
</ul>
</div>
</div>
</body>
<html>

styles.css

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,300);
#sanmenu {
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, Sans-Serif;
    font-size: 16px;
    line-height: 15px;
    text-align: center;
}
#sanmenu > ul {
    width: auto;
    list-style-type: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
    border: 1px solid #ece6e8;
    border-bottom: 3px solid #d9ced2;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    -o-border-radius: 2px;
    border-radius: 2px;
}
.san {
    width: 70%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}
#sanmenu > ul li#responsive-tab {
    display: none;
    /* Hide for large screens */
}
#sanmenu > ul li {
    display: inline-block;
    *display: inline;
    zoom: 1;
}
#sanmenu > ul li.right {
    float: right;
}
#sanmenu > ul li.has-sub {
    position: relative;
}
#sanmenu > ul li.has-sub:hover ul {
    display: block;
}
#sanmenu > ul li.has-sub ul {
    display: none;
    width: 250px;
    position: absolute;
    margin: 0;
    padding: 0;
    list-style-type: none;
    background: #ffffff;
    border: 1px solid #ece6e8;
    border-bottom: 3px solid #d9ced2;
    border-top: 0 none;
}
#sanmenu > ul li.has-sub ul li {
    display: block;
}
#sanmenu > ul li.has-sub > a {
    background-image: url('images/caret.png');
    background-repeat: no-repeat;
    background-position: 90% -95%;
}
#sanmenu > ul li.has-sub > a.active,
#sanmenu > ul li.has-sub > a:hover {
    background: #d80041 url('images/caret.png') no-repeat;
    background-position: 90% 195%;
}
#sanmenu > ul li a {
    display: block;
    padding: 12px 24px 11px 24px;
    text-decoration: none;
    color: #000;
    text-shadow: 0px 1px 0px #fff;
}
#sanmenu > ul li a.active,
#sanmenu > ul li a:hover {
    background: #d80041;
    color: #fff;
    text-shadow: 0px 1px 0px #000;
}
@media (max-width: 600px) {
    #sanmenu > ul {
        width: 100%;
    }
    #sanmenu > ul li#responsive-tab {
        display: block;
    }
    #sanmenu > ul li#responsive-tab a {
        background: url('images/menu.png') no-repeat;
        background-position: 95% -35%;
    }
    #sanmenu > ul li#responsive-tab a:hover {
        background-color: #d80041;
        background-position: 95% 135%;
    }
    #sanmenu > ul li {
        display: none;
    }
    #sanmenu > ul li.right {
        float: none;
    }
    #sanmenu > ul li.has-sub {
        position: relative;
    }
    #sanmenu > ul li.has-sub ul {
        display: block;
        position: static;
        width: 100%;
        background: #ffffff;
        border: 0 none;
    }
    #sanmenu > ul li.has-sub ul li {
        display: block !important;
    }
    #sanmenu > ul li.has-sub ul li a span {
        display: block;
        padding-left: 24px;
    }
    #sanmenu > ul li.has-sub > a {
        background-image: none;
    }
}
/* Make sure they show even if hidden in mobile view by JS */

@media (min-width: 600px) {
    #sanmenu > ul > li.collapsed {
        display: inline-block !important;
        *display: inline;
        zoom: 1;
    }
    #sanmenu > ul ul li.collapsed {
        display: block !important;
    }
}

Script.js

( function( $ ) {
$( document ).ready(function() {
// Cache the elements we'll need
var menu = $('#sanmenu');
var menuList = menu.find('ul:first');
var listItems = menu.find('li').not('#responsive-tab');

// Create responsive trigger
menuList.prepend('<li id="responsive-tab"><a href="#">Menu</a></li>');

// Toggle menu visibility
menu.on('click', '#responsive-tab', function(){
listItems.slideToggle('fast');
listItems.addClass('collapsed');
});
});
} )( jQuery );




I hope This post is very Helpful to you...................... 



New comments are not allowed.

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll create random number Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html dropdown html form html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form Multi-Step-form mysql News ticker on hover change text to image our team page password generator password strength checker Photoshop PHP populate html selectbox Popup image on click the link pure css Question type form random number generate Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips Youtube