Beben Koben si bloglang anu ganteng kalem tea seperti biasa akan membantu cara masukin ke template dengan cara termudah (bagi yg bisa) :D :) Download terlebih dahulu liteaccordion.jquery.js kemudian letakkan diatas tag </head>
liteaccordion.jquery.js (compress form)
<script type='text/javascript'>
//<![CDATA[
;(function($){$.fn.liteAccordion=function(options){var defaults={containerWidth:960,containerHeight:320,headerWidth:48,firstSlide:1,onActivate:function(){},slideSpeed:800,slideCallback:function(){},autoPlay:false,pauseOnHover:false,cycleSpeed:6000,theme:'basic',rounded:false,enumerateSlides:false},settings=$.extend({},defaults,options),$accordion=this,$slides=$accordion.find('li'),slideLen=$slides.length,slideWidth=settings.containerWidth-(slideLen*settings.headerWidth),$header=$slides.children('h2'),utils={getGroup:function(pos,index){if(this.offsetLeft===pos.left){return $header.slice(index+1,slideLen).filter(function(){return this.offsetLeft===$header.index(this)*settings.headerWidth});}else if(this.offsetLeft===pos.right){return $header.slice(0,index+1).filter(function(){return this.offsetLeft===slideWidth+($header.index(this)*settings.headerWidth)});}},nextSlide:function(slideIndex){var slide=slideIndex+1||settings.firstSlide;return function(){return slide++%slideLen;}},play:function(slideIndex){var getNext=utils.nextSlide((slideIndex)?slideIndex:''),start=function(){$header.eq(getNext()).click();};utils.playing=setInterval(start,settings.cycleSpeed);},pause:function(){clearInterval(utils.playing);},playing:0,sentinel:false};$accordion.height(settings.containerHeight).width(settings.containerWidth).addClass(settings.theme).addClass(settings.rounded&&'rounded');$header.width(settings.containerHeight).height(settings.headerWidth).eq(settings.firstSlide-1).addClass('selected');if($.browser.msie){if($.browser.version.substr(0,1)>8){$header.css('filter','none');}else if($.browser.version.substr(0,1)<7){return false;}}
$header.each(function(index){var $this=$(this),left=index*settings.headerWidth;if(index>=settings.firstSlide)left+=slideWidth;$this.css('left',left).next().width(slideWidth).css({left:left,paddingLeft:settings.headerWidth});settings.enumerateSlides&&$this.append('<b>'+(index+1)+'</b>');});$header.click(function(e){var $this=$(this),index=$header.index($this),$next=$this.next(),pos={left:index*settings.headerWidth,right:index*settings.headerWidth+slideWidth,newPos:0},$group=utils.getGroup.call(this,pos,index);if(this.offsetLeft===pos.left){pos.newPos=slideWidth;}else if(this.offsetLeft===pos.right){pos.newPos=-slideWidth;}
if(!$header.is(':animated')){if(e.originalEvent){if(utils.sentinel===this)return false;settings.onActivate.call($next);utils.sentinel=this;}else{settings.onActivate.call($next);utils.sentinel=false;}
$header.removeClass('selected').filter($this).addClass('selected');$group.animate({left:'+='+pos.newPos},settings.slideSpeed,function(){settings.slideCallback.call($next)}).next().animate({left:'+='+pos.newPos},settings.slideSpeed);}});if(settings.pauseOnHover){$accordion.hover(function(){utils.pause();},function(){utils.play($header.index($header.filter('.selected')));});}
settings.autoPlay&&utils.play();return $accordion;};})(jQuery);
//]]>
</script>
Setelah itu masuk, kemudian kode CSS-nya dimasukin sebelum tag ]]></b:skin>
Kode CSS Lite Accordion
.accordion ol { position: relative; overflow: hidden; height: 100%; margin: 0; padding: 0; list-style-type: none; }
.accordion li > h2 { color: black; font-weight: normal; margin: 0; z-index: 2; position: absolute; top: 0; left: 0; -webkit-transform: translateX(-100%) rotate(-90deg); -webkit-transform-origin: right top; -moz-transform: translateX(-100%) rotate(-90deg); -moz-transform-origin: right top;
-o-transform: translateX(-100%) rotate(-90deg); -o-transform-origin: right top; -ms-transform: translateX(-100%) rotate(-90deg); -ms-transform-origin: right top; transform: translateX(-100%) rotate(-90deg); transform-origin: right top; filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); }
.accordion li > h2 span { display: block; padding-right: 8%; text-align: right; height: 90%; margin-top: 5px; }
.accordion li > h2 b { display: inline-block; position: absolute; top: 10%; top: 42%\9; left: 10%; left: 5%\9; text-align: center; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); }
.accordion li > h2:hover { cursor: pointer; }
.accordion li > div { height: 100%; position: absolute; top: 0; z-index: 1; overflow: hidden; background: white; }
.basic li > h2 { background: #333; color: white; line-height: 1.8em; }
.basic li > div h3 { margin: 15px 10px; }
.basic li > div p { margin: 10px; font-size: 14px; }
.dark { border: 9px solid #353535; border-bottom-width: 8px; padding: 5px 5px 6px 0; background: #030303; -webkit-box-shadow: 0 -1px 0 #5b5b5b inset, 0 5px 15px rgba(0, 0, 0, 0.4); -moz-box-shadow: 0 -1px 0 #5b5b5b inset, 0 5px 15px rgba(0, 0, 0, 0.4); -o-box-shadow: 0 -1px 0 #5b5b5b inset, 0 5px 15px rgba(0, 0, 0, 0.4);
box-shadow: 0 -1px 0 #5b5b5b inset, 0 5px 15px rgba(0, 0, 0, 0.4); }
.dark li > h2 { background: #030303; font-size: 16px; line-height: 2.7em; text-shadow: 0 -1px 0 #030303; }
.dark li > h2 span { background: #353535; color: white; }
.dark li > h2 b { background: #353535; color: #030303; font-size: 20px; text-shadow: -1px 1px 0 #5b5b5b; }
.dark h2.selected span, .dark h2.selected span:hover { background: #434343; background: -webkit-gradient(linear, left top, right top, color-stop(0, #353535), color-stop(1, #555)); background: -moz-linear-gradient(top left, #353535 0%, #555 100%); }
.dark h2.selected b { background: #434343\9; }
.dark li > div { background: #030303; margin-left: 5px; }
.rounded { -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; }
.rounded li > h2 span { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
figure { display: block; width: 100%; height: 100%; margin: 0 }
figcaption { padding: 10px 15px; position: absolute; bottom: 20px; right: 30px; z-index: 3; background: black; background: rgba(0,0,0,0.7); color: white;
-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px }
Benar saja script & kode CSS bentrok dengan emoticon, download here kode CSS dan jQuery.
Kode HTML LiteAccordion
<div class='accordion' id='one'>
<ol>
<li>
<h2><span>Slide One</span></h2>
<div>
<figure>
<img alt='image' src='http://YOUR-LINK-IMAGE1.jpg'/>
<figcaption>CAPTION 1</figcaption>
</figure>
</div>
</li>
<li>
<h2><span>Slide Two</span></h2>
<div>
<figure>
<img alt='image' src='http://YOUR-LINK-IMAGE2.jpg'/>
<figcaption>CAPTION 2</figcaption>
</figure>
</div>
</li>
<li>
<h2><span>Slide Three</span></h2>
<div>
<figure>
<img alt='image' src='http://YOUR-LINK-IMAGE3.jpg'/>
<figcaption>CAPTION 3</figcaption>
</figure>
</div>
</li>
<li>
<h2><span>Slide Four</span></h2>
<div>
<figure>
<img alt='image' src='http://YOUR-LINK-IMAGE4.jpg' width='768'/>
<figcaption>CAPTION 4</figcaption>
</figure>
</div>
</li>
<li>
<h2><span>Slide Five</span></h2>
<div>
<figure>
<img alt='image' src='http://YOUR-LINK-IMAGE5.jpg'/>
<figcaption>CAPTION 5</figcaption>
</figure>
</div>
</li>
</ol>
</div>
</center>
Maka lite-accordion akan berada tepat dibawah judul blog kalian ;)<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='bLo9-Sp0t (Header)' type='Header'/>
</b:section>
</div>
---------------- LETAKKAN DISINI ----------------
Bumbu terakhir guna menjalankan jQuery lite accordion, sisipkan script berikut diatas tag </body>
Lihat hasil kerja sobat, jika tidak ada bug's sukses deh :)<script type='text/javascript'>
//<![CDATA[
$('#one').liteAccordion({
onActivate : function() {
this.find('figcaption').fadeOut();
},
slideCallback : function() {
this.find('figcaption').fadeIn();
},
autoPlay : true,
pauseOnHover : true,
theme : 'dark',
rounded : true,
enumerateSlides : true
}).find('figcaption:first').show();
$('#two').liteAccordion();
$('#three').liteAccordion({ theme : 'dark', containerWidth : 600, containerHeight : 200, slideSpeed : 600, firstSlide : 2 });
//]]>
</script>
Happy lite accordion \m/
Tidak ada komentar:
Posting Komentar