Navigasi CSS3 Sohtanaka
Eksperimen sederhana untuk menciptakan navigasi dengan efek hover menggulung dari Sohtanaka yang dulu pernah Saya tuliskan di artikel ini. Kali ini Saya hanya akan menggunakan CSS3 Transisi untuk menganimasikan efek menggulung tiap item menu:
HTML
<nav id='rolling-nav'>
<ul>
<li><a href='#' data-clone='Home'>Home</a></li>
<li><a href='#' data-clone='About'>About</a></li>
<li><a href='#' data-clone='Portfolio'>Portfolio</a></li>
<li><a href='#' data-clone='Comments'>Comments</a></li>
<li><a href='#' data-clone='Contact'>Contact</a></li>
</ul>
</nav>
CSS
#rolling-nav {
font:normal 12px 'Trebuchet MS',Arial,Sans-Serif;
color:white;
text-transform:uppercase;
}
#rolling-nav ul {
height:50px;
margin:0px 0px;
padding:0px 0px;
overflow:hidden;
}
#rolling-nav li {
float:left;
display:inline;
list-style:none;
margin:0px 0px;
padding:0px 0px;
}
#rolling-nav a,
#rolling-nav a:before {
display:block;
margin:0px 0px;
padding:0px 30px;
line-height:50px;
color:white;
text-decoration:none;
background-color:#900;
background-image:-webkit-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-moz-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-ms-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-o-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
-webkit-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
-moz-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
position:relative;
/* CSS Transisi */
-webkit-transition:all 0.3s ease-in-out;
-moz-transition:all 0.3s ease-in-out;
-ms-transition:all 0.3s ease-in-out;
-o-transition:all 0.3s ease-in-out;
transition:all 0.3s ease-in-out;
}
#rolling-nav a:before {
content:attr(data-clone); /* Memuat data atribut */
position:absolute;
top:100%;
left:0px;
display:block;
background-color:white;
background-image:-webkit-linear-gradient(top, #ddd, white);
background-image:-moz-linear-gradient(top, #ddd, white);
background-image:-ms-linear-gradient(top, #ddd, white);
background-image:-o-linear-gradient(top, #ddd, white);
background-image:linear-gradient(top, #ddd, white);
border-top:2px solid rgba(0,0,0,0.2);
color:#333;
}
#rolling-nav a:hover {
margin-top:-50px;
margin-bottom:1px;
}
Atribut data-clone
digunakan untuk menyimpan nilai kloning yang dituliskan secara manual menggantikan fungsi .clone()
dalam jQuery. Efek animasi dibuat dengan cara menganimasikan properti margin
dengan CSS transisi.
10 Comments:
hadir untuk meramaikan suasana
By abang ichal, at Sunday, May 27, 2012 at 10:45:00 AM GMT+7
mas demox sepertix kacau..., yg muncul hny menu Home dan About, kemarin jg yg muncul hny tiga menu dan saat disorot menu terakhir jd getar....,
By Rohis Facebook, at Monday, May 28, 2012 at 3:30:00 PM GMT+7
@Rohis Facebook Lihat versi luasnya:
Fiddle: http://jsfiddle.net/tovic/7yShE/embedded/result/
CSSDeck: http://cssdeck.com/item/419/fancy-rolling-navigation
By Taufik Nurrohman, at Monday, May 28, 2012 at 6:53:00 PM GMT+7
Mantef bang Tofik, Memang bang tofik Jago CSS and jQuery, salut saya bang.
By Rosyd Aqbar, at Monday, May 28, 2012 at 8:07:00 PM GMT+7
pak Taufik, saya mau tanya. Ini menu saya widget LinkList:
http://3.bp.blogspot.com/-HGR-XZo1rx8/T8r28_Uf1II/AAAAAAAAASI/tl9ifwF1Y7w/s1600/hoaaaa.jpg
ini blogku memorysite404.blogspot.com
kan linknya gak terbuka di tab baru, caranya nambahin attribut target='_blank' gmn? terimakasih sebelumnya :)
By Putra, at Sunday, June 3, 2012 at 12:39:00 PM GMT+7
@Alam Perwira Cari kode ini:
<li><a expr:href='data:link.target'><data:link.name/></a></li>
Ganti jadi seperti ini:
<li><a expr:href='data:link.target' target='_blank'><data:link.name/></a></li>
By Taufik Nurrohman, at Sunday, June 3, 2012 at 1:19:00 PM GMT+7
@Taufik Nurrohman yeah \o/
terus, kalo mau nambahin title otomatis yg isinya nama linknya gmn?
By Putra, at Monday, June 4, 2012 at 1:48:00 PM GMT+7
Bang itu nyisipinnye dimane ?
By Unknown, at Sunday, July 8, 2012 at 11:41:00 PM GMT+7
mantap kang, saya aja yg newbie bisa mengeerti
By Anonymous, at Wednesday, August 21, 2013 at 1:12:00 PM GMT+7
This comment has been removed by the author.
By Unknown, at Tuesday, September 24, 2013 at 9:43:00 PM GMT+7
Post a Comment
<< Home