Membuat Menu Bar Drop Down Responsive
Tutorial Cara Memasang Menu Navigation Bar Deopdown Responsive Di Blog
Memasang Menu bar Responsive Di Blog, Tutorial kali ini kita akan membuat menu navigation bar drop down responsive pada blogger..Sebelumnya saya juga sudah pernah posting tentang menu bar, kalian bisa memilih pada artikel berikut ini, barang kalia ada yang menarik..
Tutorial Blogger Lainnya :
nah sekarang mari kita lanjut ke tutorial cara pemasangan menu navigation bar drop down yang responsive di blog..
Tutorial Membuat Menu Bar Drop Down Responsive
- Login ke blogger.com
- Pilih menu Template, Edit HTML, Cari Kode </head>
- Setelah ketemu, masukan css berikut di atasnya...
<style type="text/css">
.slide-menu{display:none;background:#3a89b9;padding:0 15px;height:60px;line-height:60px;color:#fff!important}
.slide-menu:hover{background:#3a89b9}
#nav{font-family:'Roboto Condensed';font-weight:700;text-transform:uppercase;letter-spacing:.2px;background:#272b35;height:60px;line-height:60px;margin:0 auto;-webkit-box-sizing:initial;-moz-box-sizing:initial;box-sizing:initial}
#nav2{max-width:1060px;margin:0 auto;background:#4399cd;height:60px;line-height:60px}
.vienna-menulite{background:#4399cd;list-style:none;margin:0;float:left}
.vienna-menulite:before,.vienna-menulite:after{content:" ";display:table}
.vienna-menulite:after{clear:both}
.vienna-menulite a{display:block;padding:0 15px}
.vienna-menulite li{position:relative;margin:0}
.vienna-menulite > li{float:left}
.vienna-menulite > li > a{display:block;height:60px;line-height:60px;color:#fff}
.vienna-menulite > li > a.active{background:#4fa8dc;padding:0 20px}
.vienna-menulite > li:hover > a,.vienna-menulite > li:hover > a.active{background:#4fa8dc;color:#fff}
.vienna-menulite > li > a.active i{transform:scale(1.0);backface-visibility:hidden;vertical-align:middle}
.vienna-menulite > li > a.active i:hover{transform:scale(0.95)}
.vienna-menulite ul{list-style:none;margin:0;min-width:10em}
.vienna-menulite li ul{background:#fafafa;display:block;position:absolute;left:0;top:80%;z-index:10;visibility:hidden;opacity:0;transition:all .3s}
.vienna-menulite li li ul{left:110%;top:0}
.vienna-menulite li ul li{position:relative;margin:0}
.vienna-menulite > li.hover > ul{visibility:visible;opacity:1;top:100%}
.vienna-menulite li li.hover ul{visibility:visible;opacity:1;left:100%}
.vienna-menulite li li a{display:block;color:#666;position:relative;z-index:100;height:42px;line-height:42px;font-weight:400;text-transform:none;transition:all .3s;}
.vienna-menulite li li a:hover{background:#4399cd;color:#fff}
.vienna-menulite li li li a{z-index:20}
.vienna-menulite li .parent:after{content:"\f107";font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;padding-left:6px;transition:all .3s}
.vienna-menulite li:hover .parent:after{content:"\f106";color:#fff}
.vienna-menulite li:hover ul li .parent:after{content:"\f105";font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;padding-left:6px;color:#4399cd;float:right;transition:all .3s}
.vienna-menulite li ul li .parent:hover:after{content:"\f105";color:#fff}
#search-form{float:right;margin:0 10px;width:230px}
@media only screen and (max-width:768px){.vieleftcredit,#vierightcredit{float:none;text-align:center;margin:10px auto}.vitop-wrapper{margin:0;padding:0}.top-menulite{display:block;width:100%;padding:0 10px}.top-menulite ul{text-align:center}.top-menulite ul{display:none;height:auto}.top-menulite a#pull{color:#eee;display:inline-block;font-size:12px;padding:10px 3%;position:relative;text-align:right;width:100%;font-weight:700}.top-menulite a#pull:after{content:'\f0c9';font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:none;font-size:30px;color:#fff;display:inline-block;position:absolute;left:20px;top:0;line-height:30px}.top-menulite li{display:block;width:100%;text-align:left;border-right:none}.top-menulite li a{padding:15px 20px;display:block}.top-menulite li a:hover,nav a:active{color:#fff}.top-menulite ul li a:hover{background:#4399cd;color:#fff}.top-menulite ul li:first-child a{margin-left:0}.nav{float:none;width:100%;max-width:100%}.active{display:block}.vienna-menulite > li > a.active{border-top:4px solid #3a89b9;border-left:0;padding:0 15px}.nav li ul:before,.top-menulite li.doremifa{display:none}.nav > li{float:none;overflow:hidden;background:#4399cd;z-index:99}.nav ul{display:block;width:100%;float:none}.vienna-menulite li ul{background:#f6f6f6;box-shadow:none}.vienna-menulite li ul li a{background:#fafafa;color:#444}.vienna-menulite li li a:hover{background:#4399cd}.nav > li.hover > ul,.nav li li.hover ul{position:static}.vienna-menulite li .parent:after,.vienna-menulite li ul li .parent:after{content:"\f107";font-family:FontAwesome;font-style:normal;font-weight:normal;text-decoration:inherit;padding-right:5px;float:right;color:#fff}.vienna-menulite li:active .parent:after,.vienna-menulite li ul li:active .parent:after{color:#fff}}
@media only screen and (min-width:640px){#menu{display:block}}
</style>
- Setelah memasang css, sekarang kita tinggal memasang javascriptnya, silahan cari kode </body>
- Kalo sudah ketemu, kalian masukan javascript berikut di atsnya..
<script type="text/javascript">
//<![CDATA[
// Main Menu
var ww = document.body.clientWidth;
$(document).ready(function() {
$(".nav li a").each(function() {
if ($(this).next().length > 0) {
$(this).addClass("parent")
}
});
$(".slide-menu").click(function(e) {
e.preventDefault();
$(this).toggleClass("active");
$(".nav").toggle()
});
adjustMenu()
});
$(window).bind("resize orientationchange", function() {
ww = document.body.clientWidth;
adjustMenu()
});
var adjustMenu = function() {
if (ww < 768) {
$(".slide-menu").css("display", "inline-block");
if (!$(".slide-menu").hasClass("active")) {
$(".nav").hide()
} else {
$(".nav").show()
}
$(".nav li").unbind("mouseenter mouseleave");
$(".nav li a.parent").unbind("click").bind("click", function(e) {
e.preventDefault();
$(this).parent("li").toggleClass("hover")
})
} else if (ww >= 768) {
$(".slide-menu").css("display", "none");
$(".nav").show();
$(".nav li").removeClass("hover");
$(".nav li a").unbind("click");
$(".nav li").unbind("mouseenter mouseleave").bind("mouseenter mouseleave", function() {
$(this).toggleClass("hover")
})
}
}
//]]>
</script>
- Langkah terakhir, tinggal memasang HTMLnya, silahkan taro kode ini di tempat yang kalian inginkan..
- Misal kita pasang di bawah kode <body> atau di bawah </header>
<nav id='nav' itemscope='itemscope' itemtype='http://schema.org/SiteNavigationElement' role='navigation'>
<div id='nav2'>
<a class='slide-menu' href='#'><i class='fa fa-list'></i> Menu</a>
<ul class='nav vienna-menulite'>
<li><a class='active' href='/'><span itemprop='name'><i class='fa fa-th-list fa-lg'></i></span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>Programing</span></a>
<ul>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>DATA BIS</span></a>
<ul>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>KUAT</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>OREO</span></a></li>
</ul>
</li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>C++</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>HTML</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>JAVA</span></a>
<ul>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>ECLIPSE</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>CMD</span></a></li>
</ul>
</li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>DELPI</span></a></li>
</ul>
</li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>Tech News</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>Smartphone</span></a>
<ul>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>ANDROID</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>IOS</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>DLL</span></a></li>
</ul>
</li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>Software</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>Game</span></a></li>
<li><a href='X URL X' itemprop='url'><span itemprop='name'>tips dan trik</span></a></li>
<li class=""><a class="parent" href="X URL X" itemprop="url"><span itemprop="name">EDITING</span></a>
<ul>
<li class=""><a href="X URL X" itemprop="url"><span itemprop="name">GANTI</span></a></li>
<li class=""><a href="X URL X" itemprop="url"><span itemprop="name">GANTI</span></a></li>
<li class=""><a href="X URL X" itemprop="url"><span itemprop="name">GANTI</span></a></li>
</ul>
</li>
</ul>
</div>
</nav>
Kalo Menu Drop Downnya tidak tampil, silahkan masukan kode dibawah ini tepat di atas kode </head>
<script type='text/javascript'>
//<![CDATA[
if (typeof(jQuery) == 'undefined') {document.write("<scr" + "ipt type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"></scr" + "ipt>");}
//]]>
</script>
- Ok, kalo sudah yankin naronya di mana dan pas, tinggal save template...
- Dan Selesai
Cukup sekian dan terima kasih, semoga artikel tentnag Cara membuat menu navigation bar drop down responsive di blog ini bermanfaat..
Apabil ada penjelasan yang kurang jelas seperti pemasnagan tag html silahkan bertanya di kolom komentar..
https://ivanlanin.files.wordpress.com/2012/02/terima-kasih-e1330228023845.png
ReplyDeletehttps://i.ytimg.com/vi/m8mZZq7kJWk/maxresdefault.jpg
DeleteNama si komentator ahahahaa
Deleteterimakasih gan, jos banget menunya :)
ReplyDeleteMelebarkan ul li nya gimana ya ? , punya saya kan di dropdownnya panjang, dia malah kepotong sama dibawahnya...
ReplyDeleteMelebarkan / memanjangkan gan / coba ss contoh masalahnya.
Deletekeren blog nya, belajar donk bang
ReplyDelete