Apa yang perlu di siapkan?
Siapkan 3 atau 4 gambar untuk slideshow. Buat dengan ukuran width:280px dan Heigh:240px.
Format yang digunakan jpeg, png atau gif. Kalau saya pribadi merekomendasikan format jpeg.
Apa yang harus di edit?
- File stylesheet.css
- header.tpl
- home.tpl
Untuk mengujinya, sebaiknya Anda mencoba di localhost terlebih dahulu, supaya mudah dalam pengeditan.
menempatkan gambar
1. Buat folder baru di direktori theme Anda, beri nama dengan Slide atau Slideshow. Sehingga posisinya akan seperti ini :
Code: Select all
catalog\view\theme\namatheme\slide\
Mengatur stylesheet.css.
1. Buka file stylesheet.css, yang berada di :
Code: Select all
catalog\view\theme\birukupro\stylesheet\
Code: Select all
#slideshow {
position:relative;
width: 580px;
height: 240px;
padding-top:5px;
padding-bottom:5px;
}
#slideshow DIV {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
width:580px;
height:240px;
background-color: #FFF;
}
#slideshow DIV.active {
z-index:10;
opacity:1.0;
}
#slideshow DIV.last-active {
z-index:9;
}
#slideshow DIV IMG {
width:580px;
height: 240px;
display: block;
border: 0;
margin-bottom: 10px;
}
Menambahkan JavaScript
1. Buka file header.tpl yang berada di:
Code: Select all
catalog\view\theme\namatheme\template\common\
Code: Select all
<script type="text/javascript">
/***
Simple jQuery Slideshow Script
Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc. Please link out to me if you like it :)
***/
function slideSwitch() {
var $active = $('#slideshow DIV.active');
if ( $active.length == 0 ) $active = $('#slideshow DIV:last');
// use this to pull the divs in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#slideshow DIV:first');
// uncomment below to pull the divs randomly
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next = $( $sibs[ rndNum ] );
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval( "slideSwitch()", 5000 );
});
</script>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript"><!--
var t;
function top() {
if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){
window.scrollBy(0,-50);
t=setTimeout('top()',20);
}
else clearTimeout(t);
}
//--></SCRIPT>
Menambahkan alamat gambar dan URL pada home.tpl
Ini bagian terpenting, padafile home.tpl kita akan tempatkan lokasi gambar dan url tujuannya.
1. Buka file home.tpl, lokasi berada di:
Code: Select all
catalog\view\theme\namatheme\template\common\
Code: Select all
<div id="slideshow">
<div class="active">
<a href="http://urltujuan" target="_self"><img src="catalog/view/theme/namatheme/slide/slide1.jpg" alt="Slideshow Image 1" /></a>
</div>
<div>
<a href="http://urltujuan" target="_self"><img src="catalog/view/theme/namatheme/slide/slide2.jpg" alt="Slideshow Image 2" /></a>
</div>
<div>
<a href="http://urltujuan" target="_self"><img src="catalog/view/theme/namatheme/slide/slide3.jpg" alt="Slideshow Image 3" /></a>
</div>
</div>
Jika Anda mengecek di localhost dan berjalan dengan benar maka Anda tinggal menguploadnya saja ke server hosting Anda. Jangan lupa sesuaikan path dan url tujuannya.
Demonya bisa Anda lihat di sini:
http://bit.ly/cgyOad
semoga bisa membantu
