comman header section
////////////////////////////////
<header class="header">
<div class="sticky-header">
<div class="logo_menu_sec">
<div class="container">
<div class="logo_sec"> <a href=""><img src="images/logoee.png" alt=""></a> </div>
<div class="menu_sec">
<div class="menu">
<ul>
<li class="active"><a href="#" target="_self" >Main Item 1</a></li>
<li><a href="#" target="_self" >Main Item 2</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
<li><a href="#" target="_self" >Main Item 3</a></li>
<li><a href="#" target="_self" >Main Item 6</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</header>
css
////////////////////////
.header
{
position: relative;
background: #000;
z-index: 999;
}
.sticky-header
{
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-o-transition: 0.3s;
position: static;
top: 0px;
float: left;
width: 100%;
background: #fff;
}
.sticky-header.sticky
{
background: #fff;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.5);
}
.logo_menu_sec
{
position: relative;
width: 100%;
float: left;
}
.logo_menu_sec .logo_sec
{
float: left;
width: 30%;
}
.logo_menu_sec .logo_sec img
{
height: 100%;
width: auto;
}
.logo_menu_sec .menu_sec
{
float: left;
width: 70%;
}
.menu
{
border: none;
border: 0px;
margin: 0px;
padding: 0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
float: right;
text-align: right;
width: auto;
}
.menu ul
{
background: none;
height: 35px;
list-style: none;
margin: 0;
padding: 0;
}
.menu li
{
float: left;
padding: 0px;
}
.menu li a
{
background: none bottom right no-repeat;
color: #000;
display: block;
font-weight: normal;
line-height: 35px;
margin: 0px;
padding: 25px 25px;
text-align: center;
text-decoration: none;
}
.menu li a:hover, .menu ul li:hover a
{
background: #273ede;
color: #FFFFFF;
text-decoration: none;
}
.menu ul li.active { background-color: #000; }
.menu ul li.active a { color: #fff; }
.menu li ul
{
background: #006633;
display: none;
height: auto;
padding: 0px;
margin: 0px;
border: 0px;
position: absolute;
width: 225px;
z-index: 200;/*top:1em;
/*left:0;*/
}
.menu li:hover ul { display: block; }
.menu li li
{
background: #000 bottom left no-repeat;
display: block;
float: none;
margin: 0px;
padding: 0px;
width: 225px;
}
.menu li:hover li a { background: none; }
.menu li ul a
{
display: block;
height: 30px;
font-size: 12px;
font-style: normal;
margin: 0px;
padding: 0px 10px 5px 15px;
text-align: left;
}
.menu li ul a:hover, .menu li ul li:hover a
{
background: #fff center left no-repeat;
border: 0px;
color: #000;
text-decoration: none;
}
.menu p { clear: left; }
#smartbutton
{
float: right;
width: 20px;
height: 15px;
cursor: pointer;
padding: 7px;
border: 1px solid #999;
border-radius: 6px;
margin-top: 18px;
display: none;
}
.buttonline
{
background-color: #999;
height: 3px;
margin-top: 4px;
}
.buttonline:first-child { margin-top: 0px; }
/* standard menu */
@media only screen and (min-width:751px) {
#smartbutton { display: none; }
.menu { display: block !important; }
}
/* smart menu */
@media only screen and (max-width:750px) {
#smartbutton { display: inline-block; }
.menu
{
display: none;
width: 100%;
position: relative;
top: 5px;
}
}
Script
//////////////
<script>
if ($('.sticky-header').length >= 1) {
$(window).scroll(function() {
var header = $(document).scrollTop();
var headerHeight = $('.header').height();
if (header > headerHeight) {
$('.sticky-header').addClass('sticky');
$('.sticky-header').fadeIn();
} else {
$('.sticky-header').removeClass('sticky');
}
});
}
</script>
<script>
// create smartbutton
$('.menu').before('<div id="smartbutton"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
// add click listener
$('#smartbutton').click(function(event)
{
$('.menu').animate({height:'toggle'},200);
});
</script>
////////////////////////////////
<header class="header">
<div class="sticky-header">
<div class="logo_menu_sec">
<div class="container">
<div class="logo_sec"> <a href=""><img src="images/logoee.png" alt=""></a> </div>
<div class="menu_sec">
<div class="menu">
<ul>
<li class="active"><a href="#" target="_self" >Main Item 1</a></li>
<li><a href="#" target="_self" >Main Item 2</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
<li><a href="#" target="_self" >Main Item 3</a></li>
<li><a href="#" target="_self" >Main Item 6</a>
<ul>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
<li><a href="#" target="_self" >Test Sub Item</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</header>
css
////////////////////////
.header
{
position: relative;
background: #000;
z-index: 999;
}
.sticky-header
{
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-o-transition: 0.3s;
position: static;
top: 0px;
float: left;
width: 100%;
background: #fff;
}
.sticky-header.sticky
{
background: #fff;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.5);
}
.logo_menu_sec
{
position: relative;
width: 100%;
float: left;
}
.logo_menu_sec .logo_sec
{
float: left;
width: 30%;
}
.logo_menu_sec .logo_sec img
{
height: 100%;
width: auto;
}
.logo_menu_sec .menu_sec
{
float: left;
width: 70%;
}
.menu
{
border: none;
border: 0px;
margin: 0px;
padding: 0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
float: right;
text-align: right;
width: auto;
}
.menu ul
{
background: none;
height: 35px;
list-style: none;
margin: 0;
padding: 0;
}
.menu li
{
float: left;
padding: 0px;
}
.menu li a
{
background: none bottom right no-repeat;
color: #000;
display: block;
font-weight: normal;
line-height: 35px;
margin: 0px;
padding: 25px 25px;
text-align: center;
text-decoration: none;
}
.menu li a:hover, .menu ul li:hover a
{
background: #273ede;
color: #FFFFFF;
text-decoration: none;
}
.menu ul li.active { background-color: #000; }
.menu ul li.active a { color: #fff; }
.menu li ul
{
background: #006633;
display: none;
height: auto;
padding: 0px;
margin: 0px;
border: 0px;
position: absolute;
width: 225px;
z-index: 200;/*top:1em;
/*left:0;*/
}
.menu li:hover ul { display: block; }
.menu li li
{
background: #000 bottom left no-repeat;
display: block;
float: none;
margin: 0px;
padding: 0px;
width: 225px;
}
.menu li:hover li a { background: none; }
.menu li ul a
{
display: block;
height: 30px;
font-size: 12px;
font-style: normal;
margin: 0px;
padding: 0px 10px 5px 15px;
text-align: left;
}
.menu li ul a:hover, .menu li ul li:hover a
{
background: #fff center left no-repeat;
border: 0px;
color: #000;
text-decoration: none;
}
.menu p { clear: left; }
#smartbutton
{
float: right;
width: 20px;
height: 15px;
cursor: pointer;
padding: 7px;
border: 1px solid #999;
border-radius: 6px;
margin-top: 18px;
display: none;
}
.buttonline
{
background-color: #999;
height: 3px;
margin-top: 4px;
}
.buttonline:first-child { margin-top: 0px; }
/* standard menu */
@media only screen and (min-width:751px) {
#smartbutton { display: none; }
.menu { display: block !important; }
}
/* smart menu */
@media only screen and (max-width:750px) {
#smartbutton { display: inline-block; }
.menu
{
display: none;
width: 100%;
position: relative;
top: 5px;
}
}
Script
//////////////
<script>
if ($('.sticky-header').length >= 1) {
$(window).scroll(function() {
var header = $(document).scrollTop();
var headerHeight = $('.header').height();
if (header > headerHeight) {
$('.sticky-header').addClass('sticky');
$('.sticky-header').fadeIn();
} else {
$('.sticky-header').removeClass('sticky');
}
});
}
</script>
<script>
// create smartbutton
$('.menu').before('<div id="smartbutton"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
$('#smartbutton').append('<div class="buttonline"></div>');
// add click listener
$('#smartbutton').click(function(event)
{
$('.menu').animate({height:'toggle'},200);
});
</script>
No comments:
Post a Comment