ไม่ทราบว่าจะใส่ code นี้ได้ที่ไหนดีครับ
<?php echo $this->helper('core/js')->includeSkinScript('js/jquery.nivo.slider.js'); ?>
<?php echo Mage::getBaseDir() . "js/jquery.nivo.slider.js" ?>
ถ้าจะไว้ใน banner.phtml ซึ่งอยู่ใน appdesignfrontenddefaultToys emplatewidgetglideranner.phtml
จาก banner.phtml
<style>
.slideshow {
position:relative;
}
.slideshow .items div {
float:left;
opacity:0.0;
position:absolute;
z-index:8;
}
.slideshow .items div.active {
opacity:1.0;
z-index:10;
}
</style>
<script>
function slideSwitch() {
var active = jQuery('.slideshow .items .active');
// use this to pull the images in the order they appear in the markup
var next = jQuery(active).next().length ? jQuery(active).next() : jQuery('.slideshow .items div:first');
jQuery(next).css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
jQuery(active).removeClass('active');
});
jQuery(active).animate({opacity:0.0}, 1000, function(){
});
}
// execute your scripts when the DOM is ready. this is mostly a good habit
jQuery('document').ready(function() {
var active = jQuery('.slideshow .items .active');
if ( active.length == 0 ) {
active = jQuery('.slideshow .items div:first');
active.addClass('active').animate({opacity: 1.0}, 1000);
}
jQuery(function() {
setInterval( "slideSwitch()", 5000 );
});
});
</script>
<div class="slideshow">
<div class="items">
<?php foreach($this->sectionArr as $key => $section) { ?>
<div class="">
<?php echo $section; ?>
</div>
<?php } ?>
</div>
</div>