Cara Membuat Tab-View Dengan CSS3 Dan JQuery
Beberapa hari yang lalu Tutorial For You pernah share tentang Cara Membuat Fans Page Pop-up Dengan JQuery, hari ini tutorial for you mau share Cara Membuat Tab-view Dengan CSS3 Dan JQuery, untuk melihat tampilannya, klik tombol demo di bawah ini :
Tanpa basa basi langsung saja kita ikuti tutorial berikut ini :
1. Login ke Blogger
2. Pilih tab Design > Edit HTML
3. Cari kode ]]></b:skin>
4. Copy kode script di bawah dan pastekan tepat di atas kode ]]></b:skin>
#tabs{
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
font-family: Arial, Helvetica;
font-size: small;
}
#tabs li{
float: left;
}
#tabs a{
position: relative;
background: #ddd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
background-image: -webkit-linear-gradient(top, #fff, #ddd);
background-image: -moz-linear-gradient(top, #fff, #ddd);
background-image: -ms-linear-gradient(top, #fff, #ddd);
background-image: -o-linear-gradient(top, #fff, #ddd);
background-image: linear-gradient(to bottom, #fff, #ddd);
padding: .5em 3.5em;
float: left;
text-decoration: none;
width: auto;
color: #444;
text-shadow: 0 1px 0 rgba(255,255,255,.8);
-webkit-border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
border-radius: 5px 0 0 0;
-moz-box-shadow: 0 2px 2px rgba(0,0,0,.4);
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,.4);
box-shadow: 0 2px 2px rgba(0,0,0,.4);
}
#tabs a:hover,
#tabs a:hover::after,
#tabs a:focus,
#tabs a:focus::after{
background: #fff;
}
#tabs a:focus{
outline: 0;
}
#tabs a::after{
content:'';
position:absolute;
z-index: 1;
top: 0;
right: -.5em;
bottom: 0;
width: .7em;
background: #ddd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
background-image: -webkit-linear-gradient(top, #fff, #ddd);
background-image: -moz-linear-gradient(top, #fff, #ddd);
background-image: -ms-linear-gradient(top, #fff, #ddd);
background-image: -o-linear-gradient(top, #fff, #ddd);
background-image: linear-gradient(to bottom, #fff, #ddd);
-moz-box-shadow: 2px 2px 2px rgba(0,0,0,.4);
-webkit-box-shadow: 2px 2px 2px rgba(0,0,0,.4);
box-shadow: 2px 2px 2px rgba(0,0,0,.4);
-webkit-transform: skew(10deg);
-moz-transform: skew(10deg);
-ms-transform: skew(10deg);
-o-transform: skew(10deg);
transform: skew(10deg);
-webkit-border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
border-radius: 0 5px 0 0;
border:#ddd;
}
#tabs #current a,
#tabs #current a::after{
background: #fff;
z-index: 3;
}
#content
background: #fff;
padding: 2em;
height: 220px;
position: relative;
z-index: 2;
-moz-border-radius: 0 5px 5px 5px;
-webkit-border-radius: 0 5px 5px 5px;
border-radius: 0 5px 5px 5px;
-moz-box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
-webkit-box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
}
#content p
{
margin: 0 0 15px 0;
}
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
font-family: Arial, Helvetica;
font-size: small;
}
#tabs li{
float: left;
}
#tabs a{
position: relative;
background: #ddd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
background-image: -webkit-linear-gradient(top, #fff, #ddd);
background-image: -moz-linear-gradient(top, #fff, #ddd);
background-image: -ms-linear-gradient(top, #fff, #ddd);
background-image: -o-linear-gradient(top, #fff, #ddd);
background-image: linear-gradient(to bottom, #fff, #ddd);
padding: .5em 3.5em;
float: left;
text-decoration: none;
width: auto;
color: #444;
text-shadow: 0 1px 0 rgba(255,255,255,.8);
-webkit-border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
border-radius: 5px 0 0 0;
-moz-box-shadow: 0 2px 2px rgba(0,0,0,.4);
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,.4);
box-shadow: 0 2px 2px rgba(0,0,0,.4);
}
#tabs a:hover,
#tabs a:hover::after,
#tabs a:focus,
#tabs a:focus::after{
background: #fff;
}
#tabs a:focus{
outline: 0;
}
#tabs a::after{
content:'';
position:absolute;
z-index: 1;
top: 0;
right: -.5em;
bottom: 0;
width: .7em;
background: #ddd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
background-image: -webkit-linear-gradient(top, #fff, #ddd);
background-image: -moz-linear-gradient(top, #fff, #ddd);
background-image: -ms-linear-gradient(top, #fff, #ddd);
background-image: -o-linear-gradient(top, #fff, #ddd);
background-image: linear-gradient(to bottom, #fff, #ddd);
-moz-box-shadow: 2px 2px 2px rgba(0,0,0,.4);
-webkit-box-shadow: 2px 2px 2px rgba(0,0,0,.4);
box-shadow: 2px 2px 2px rgba(0,0,0,.4);
-webkit-transform: skew(10deg);
-moz-transform: skew(10deg);
-ms-transform: skew(10deg);
-o-transform: skew(10deg);
transform: skew(10deg);
-webkit-border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
border-radius: 0 5px 0 0;
border:#ddd;
}
#tabs #current a,
#tabs #current a::after{
background: #fff;
z-index: 3;
}
#content
background: #fff;
padding: 2em;
height: 220px;
position: relative;
z-index: 2;
-moz-border-radius: 0 5px 5px 5px;
-webkit-border-radius: 0 5px 5px 5px;
border-radius: 0 5px 5px 5px;
-moz-box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
-webkit-box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
}
#content p
{
margin: 0 0 15px 0;
}
5. Kemudian cari kode </body>
6. Setelah ketemu, copy kode di bawah ini dan pastekan tepat di atas kode </body>
<script src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
<script>
$(document).ready(function() {
$("#content div").hide(); // Initially hide all content
$("#tabs li:first").attr("id","current"); // Activate first tab
$("#content div:first").fadeIn(); // Show first tab content
$('#tabs a').click(function(e) {
e.preventDefault();
$("#content div").hide(); //Hide all content
$("#tabs li").attr("id",""); //Reset id's
$(this).parent().attr("id","current"); // Activate this
$('#' + $(this).attr('title')).fadeIn(); // Show content for current tab
});
})();
</script>
<script>
$(document).ready(function() {
$("#content div").hide(); // Initially hide all content
$("#tabs li:first").attr("id","current"); // Activate first tab
$("#content div:first").fadeIn(); // Show first tab content
$('#tabs a').click(function(e) {
e.preventDefault();
$("#content div").hide(); //Hide all content
$("#tabs li").attr("id",""); //Reset id's
$(this).parent().attr("id","current"); // Activate this
$('#' + $(this).attr('title')).fadeIn(); // Show content for current tab
});
})();
</script>
7. Simpan template kamu
8. Pilih tab Design > add Gadget > HTML/JavaScript
9. Copy kode di bawah ini dan pastekan ke dalam gadget
<ul id="tabs">
<li><a href="#" title="tab1">One</a></li>
<li><a href="#" title="tab2">Two</a></li>
<li><a href="#" title="tab3">Three</a></li>
<li><a href="#" title="tab4">Four</a></li>
</ul>
<div id="content">
<div id="tab1">
<p>Isi Konten Tab 1</p>
</div>
<div id="tab2">
<p>Isi Konten Tab 2</p>
</div>
<div id="tab3">
<p>Isi Konten Tab 3</p>
</div>
<div id="tab4">
<p>Isi Konten Tab 4</p>
</div>
</div>
<p><span style='float:right;font:italic 10px Arial, Sans-Serif;'><a href='http://www.tutorial-4u.com/2012/04/tab-view-dengan-css3-dan-jquery.html' target='_blank' title='Get this widget !'>:: Get this widget ! ::</a></span></p>
<li><a href="#" title="tab1">One</a></li>
<li><a href="#" title="tab2">Two</a></li>
<li><a href="#" title="tab3">Three</a></li>
<li><a href="#" title="tab4">Four</a></li>
</ul>
<div id="content">
<div id="tab1">
<p>Isi Konten Tab 1</p>
</div>
<div id="tab2">
<p>Isi Konten Tab 2</p>
</div>
<div id="tab3">
<p>Isi Konten Tab 3</p>
</div>
<div id="tab4">
<p>Isi Konten Tab 4</p>
</div>
</div>
<p><span style='float:right;font:italic 10px Arial, Sans-Serif;'><a href='http://www.tutorial-4u.com/2012/04/tab-view-dengan-css3-dan-jquery.html' target='_blank' title='Get this widget !'>:: Get this widget ! ::</a></span></p>
10. Setelah selesai simpan gadget kamu dan lihat hasil
Selesai sudah tutorial Cara Membuat Tab-view Dengan CSS3 Dan JQuery, selamat mencoba, semoga berhasil dan bermanfaat
Sumber Script
www.htmldrive.net
Source: www.tutorial-4u.com