- Cara membuatnya :
- Login blogger
- Rancangan, Edit Html, Cari kode ]]></b:skin>
- Dan Simpan kode berikut diatasnya :
/* ---------------
Navigasi menu fadein and fadeout with jquery
---------------------------------- */
#navMenufad li {
float:left;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOJjeLunruP4RfnVet1GKiy7qG0qwSzNYv6uC4fVaOKh5pj2lFhWKBg6CQ6Zql8JdiwHkjppvEB_gbF0pjbJPosAWMrhFC3s2GK-lA6lewrwLgaQayVJCqixzgjuQJBcnmX-0Z8GyyLHc/s1600/default.jpg) no-repeat center center; /* default background image*/
width:90px; /* width and height of the menu item */
height:53px;
border-left:1px solid #111; /* simulate pixel perfect using border */
border-right:1px solid #333;
border-top:1px solid #555;
border-bottom:1px solid #333;
position:relative;/* must set it as relative, because .hover class top and left with absolute position will be positioned according to li. */
}
#navMenufad li a {
z-index:20;/* z-index must be higher than .hover class */
display:block;/* display as block and set the height according to the height of the menu to make the whole LI clickable */
height:53px;
position:relative;
color:#777;
}
#navMenufad li .hover {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD-3FEV_AWxe-WJYDPYLeW5sR1KIDAwjH4CreoHMPXdV8bGXMRO2WjDwnce1xTOUCV-pbMBmKkgoFwfYvxoEO5hp5je9PH6wrOKhypVHQAmSESQGybUw6WIRGtlGiiHAlEyfL9uJzxjF0/s1600/over.jpg)no-repeat center center;/* mouseover image */
position:absolute;/* must be postion absolute */
width:90px; /*width, height, left and top to fill the whole LI item */
height:53px;
left:0;
top:0;
z-index:0;/* display under the Anchor tag*/
display:none;/* hide it by default*/
}
#navMenufad li.selected {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi24xTpd6JW0UjxzoMePrfdcPHABXc6p-RjdyMnbyp8blu5ZhO4Xlb2Q2qy_P7g-Qwvh56D6JPpmWUfobIq2TtIGCukzW-CztOhAfAqxZ4kEPwOxPG1TWxxnPtXvupr3xyAdJl-uPGqFaQ/s1600/selected.jpg) no-repeat center center;/* selected image */
}
Untuk gambar in dan out nya kawan bisa ganti sesuai kreasi, yang saya pakai image nya berukuran Width 90px dan height nya 53px, silahkan ssuaikan dengan CSS nya jika ukurannya dan gambarnya diganti maka Lebar dan tinggi dalam CSS nya juga disamakan dengan ukuran gambar yang baru.....
- simpan script berikut diatas kode </head> :
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
//Append a div with hover class to all the LI
$('#navMenufad li').append('<div class="hover"><\/div>');
$('#navMenufad li').hover(
//Mouseover, fadeIn the hidden hover class
function() {
$(this).children('div').fadeIn('1000');
},
//Mouseout, fadeOut the hover class
function() {
$(this).children('div').fadeOut('1000');
}).click (function () {
//Add selected class if user clicked on it
$(this).addClass('selected');
});
});
//]]>
</script>
- Simpan kode berikut pada bagian html yang diinginkan sesuai template kawan-kawan :
<li><a href="#">Test 1</a></li>
<li><a href="#">Test 2</a></li>
<li><a href="#">Test 3</a></li>
<li><a href="#">Test 4</a></li>
<li><a href="#">Test 5</a></li>
<li><a href="#">Test 6</a></li>
</ul>
- simpan template....
Selesai....
Komentar :
Posting Komentar