Salut Vizitator,
Astazi am sa iti prezint un meniu negru, modern.. creeat de mine. Deci:
In head adaugati asta:
In foaia de stil css adaugam:
Iar acum codul:
Demo: Aici - CLICK
Sper ca v-am fost de ajutor.
Numai bine, BaxAndrei .
Astazi am sa iti prezint un meniu negru, modern.. creeat de mine. Deci:
In head adaugati asta:
Cod:
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$( document ).ready(function() {
$('#meniubx').prepend('<div id="indicatorContainer"><div id="pIndicator"><div id="cIndicator"></div></div></div>');
var activeElement = $('#meniubx>ul>li:first');
$('#meniubx>ul>li').each(function() {
if ($(this).hasClass('active')) {
activeElement = $(this);
}
});
var posLeft = activeElement.position().left;
var elementWidth = activeElement.width();
posLeft = posLeft + elementWidth/2 -6;
if (activeElement.hasClass('subm')) {
posLeft -= 6;
}
$('#meniubx #pIndicator').css('left', posLeft);
var element, leftPos, indicator = $('#meniubx pIndicator');
$("#meniubx>ul>li").hover(function() {
element = $(this);
var w = element.width();
if ($(this).hasClass('subm'))
{
leftPos = element.position().left + w/2 - 12;
}
else {
leftPos = element.position().left + w/2 - 6;
}
$('#meniubx #pIndicator').css('left', leftPos);
}
, function() {
$('#meniubx #pIndicator').css('left', posLeft);
});
$('#meniubx>ul>.subm>ul').append('<div class="submenuArrow"></div>');
$('#meniubx>ul').children('.subm').each(function() {
var posLeftArrow = $(this).width();
posLeftArrow /= 2;
posLeftArrow -= 12;
$(this).find('.submenuArrow').css('left', posLeftArrow);
});
$('#meniubx>ul').prepend('<li id="menu-button"><a>Menu</a></li>');
$( "#menu-button" ).click(function(){
if ($(this).parent().hasClass('open')) {
$(this).parent().removeClass('open');
}
else {
$(this).parent().addClass('open');
}
});
});
</script>
In foaia de stil css adaugam:
Cod:
#meniubx > ul > li.activ {
background: rgb(3, 70, 128);
}
#meniubx {
position: relative;
height: 44px;
background: #000000;
width: auto;
}
#meniubx ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 1;
}
#meniubx > ul {
position: relative;
display: block;
background: #000000;
height: 32px;
width: 100%;
z-index: 500;
}
#meniubx > ul > li {
display: block;
position: relative;
float: left;
margin: 0;
padding: 0;
}
#meniubx > ul > #menu-button {
display: none;
}
#meniubx ul li a {
display: block;
font-family: Helvetica, sans-serif;
text-decoration: none;
}
#meniubx > ul > li > a {
font-size: 14px;
font-weight: bold;
padding: 15px 20px;
color: #7a8189;
text-transform: uppercase;
-webkit-transition: color 0.25s ease-out;
-moz-transition: color 0.25s ease-out;
-ms-transition: color 0.25s ease-out;
-o-transition: color 0.25s ease-out;
transition: color 0.25s ease-out;
}
#meniubx > ul > li.subm > a {
padding-right: 32px;
}
#meniubx > ul > li:hover > a {
color: #ffffff;
}
#meniubx li.subm::after {
display: block;
content: '';
position: absolute;
width: 0;
height: 0;
}
#meniubx > ul > li.subm::after {
right: 10px;
top: 20px;
border: 5px solid transparent;
border-top-color: #7a8189;
}
#meniubx > ul > li:hover::after {
border-top-color: #ffffff;
}
#indicatorContainer {
position: absolute;
height: 12px;
width: 100%;
bottom: 0px;
overflow: hidden;
z-index: -1;
}
#pIndicator {
position: absolute;
height: 0;
width: 100%;
border: 12px solid transparent;
border-top-color: #2b2f3a;
z-index: -2;
-webkit-transition: left .25s ease;
-moz-transition: left .25s ease;
-ms-transition: left .25s ease;
-o-transition: left .25s ease;
transition: left .25s ease;
}
#cIndicator {
position: absolute;
height: 0;
width: 100%;
border: 12px solid transparent;
border-top-color: #2b2f3a;
top: -12px;
right: 100%;
z-index: -2;
}
#meniubx ul ul {
position: absolute;
left: -9999px;
top: 70px;
opacity: 0;
-webkit-transition: opacity .3s ease, top .25s ease;
-moz-transition: opacity .3s ease, top .25s ease;
-ms-transition: opacity .3s ease, top .25s ease;
-o-transition: opacity .3s ease, top .25s ease;
transition: opacity .3s ease, top .25s ease;
z-index: 1000;
}
#meniubx ul ul ul {
top: 37px;
padding-left: 5px;
}
#meniubx ul ul li {
position: relative;
}
#meniubx > ul > li:hover > ul {
left: auto;
top: 44px;
opacity: 1;
}
#meniubx ul ul li:hover > ul {
left: 170px;
top: 0;
opacity: 1;
}
#meniubx ul ul li a {
width: 130px;
border-bottom: 1px solid #eee;
padding: 10px 20px;
font-size: 12px;
color: #303233;
background: #fff;
-webkit-transition: all .35s ease;
-moz-transition: all .35s ease;
-ms-transition: all .35s ease;
-o-transition: all .35s ease;
transition: all .35s ease;
}
#meniubx ul ul li:hover > a {
background: #f6f6f6;
color: #8c9195;
}
#meniubx ul ul li:ultimul-child > a,
#meniubx ul ul li.ultimul > a {
border-bottom: 0;
}
.submenuArrow {
border: 6px solid transparent;
width: 0;
height: 0;
border-bottom-color: #fff;
position: absolute;
top: -12px;
}
#meniubx ul ul li.subm::after {
border: 4px solid transparent;
border-left-color: #303233;
right: 10px;
top: 12px;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;
-webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease;
}
#meniubx ul ul li.subm:hover::after {
border-left-color: #fff;
right: -5px;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
@media all and (max-width: 800px), only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min--moz-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (-o-min-device-pixel-ratio: 2/1) and (max-width: 1024px), only screen and (min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min-resolution: 192dpi) and (max-width: 1024px), only screen and (min-resolution: 2dppx) and (max-width: 1024px) {
#meniubx {
width: auto;
}
#meniubx ul {
width: auto;
}
#meniubx .submenuArrow,
#meniubx #indicatorContainer {
display: none;
}
#meniubx > ul {
height: auto;
display: block;
}
#meniubx > ul > li {
float: none;
}
#meniubx li,
#meniubx > ul > li {
display: none;
}
#meniubx ul ul,
#meniubx ul ul ul,
#meniubx ul > li:hover > ul,
#meniubx ul ul > li:hover > ul {
position: relative;
left: auto;
top: auto;
opacity: 1;
padding-left: 0;
}
#meniubx ul .subm::after {
display: none;
}
#meniubx ul li a {
padding: 12px 20px;
}
#meniubx ul ul li a {
border: 0;
background: none;
width: auto;
padding: 8px 35px;
}
#meniubx ul ul li:hover > a {
background: none;
color: #8c9195;
}
#meniubx ul ul ul a {
padding: 8px 50px;
}
#meniubx ul ul ul ul a {
padding: 8px 65px;
}
#meniubx ul ul ul ul ul a {
padding: 8px 80px;
}
#meniubx ul ul ul ul ul ul a {
padding: 8px 95px;
}
#meniubx > ul > #menu-button {
display: block;
cursor: pointer;
}
#meniubx #menu-button > a {
padding: 14px 20px;
}
#meniubx ul.open li,
#meniubx > ul.open > li {
display: block;
}
#meniubx > ul.open > li#menu-button > a {
color: #fff;
border-bottom: 1px solid rgba(150, 150, 150, 0.1);
}
#meniubx #menu-button::after {
display: block;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #7a8189;
border-bottom: 2px solid #7a8189;
right: 20px;
top: 15px;
}
#meniubx #menu-button::before {
display: block;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #7a8189;
right: 20px;
top: 25px;
}
#meniubx ul.open #menu-button::after,
#meniubx ul.open #menu-button::before {
border-color: #fff;
}
}
Iar acum codul:
Cod:
<div id='meniubx'>
<ul>
<li class='activ'><a href='#'><span>Link 1</span></a></li>
<li class='subm'><a href='#'><span>Link 2</span></a>
<ul>
<li class='subm'><a href='#'><span>Link 1</span></a>
<ul>
<li><a href='#'><span>Link 1</span></a></li>
<li class='ultimul'><a href='#'><span>Link 2</span></a></li>
</ul>
</li>
<li class='subm'><a href='#'><span>Link 2</span></a>
<ul>
<li><a href='#'><span>Link 1</span></a></li>
<li class='ultimul'><a href='#'><span>Link 2</span></a></li>
</ul>
</li>
</ul>
</li>
<li><a href='#'><span>Link 3</span></a></li>
<li class='ultimul'><a href='#'><span>Link 4</span></a></li>
</ul>
</div>
Demo: Aici - CLICK
Sper ca v-am fost de ajutor.
Numai bine, BaxAndrei .