I want to make slideshow in wordpress, but for some reason it doesn't work:
my .js file:
(function ($) {
function slideSwitch() {
var $active = $('#gallery1 IMG.active');
if ( $active.length == 0 ) $active = $('#gallery1 IMG:last');
var $next = $active.next().length ? $active.next()
: $('#gallery1 IMG:first');
$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 );
});
});
CSS styles:
#gallery1{
position: relative;
width:400px;
height:300px;
}
#gallery1 img{
position:absolute;
z-index:8;
}
#gallery1 img.active{
z-index:10;
}
#gallery1 img.last-active{
z-index:9;
}
html code:
<div id="gallery1">
<img src="img1.jpg" class="active"/>
<img src="img2.jpg"/>
<img src="img3.jpg"/>
</div>
Chromes developer tools doesn't show any errors. While firebug, shows this error: error breakpoints:
But I don't get it what's wrong with first image, it loads fine. Does anyone see the problem?