Reputation: 2466
example: http://jsfiddle.net/kuTLf/
code looks like this:
<div id="main">
<div id="slideshow" class="pics">
<div id="nav"></div>
<img src="http://cloud.github.com/downloads/malsup/cycle/beach1.jpg" width="200" height="200" />
<img src="http://cloud.github.com/downloads/malsup/cycle/beach2.jpg" width="200" height="200" />
<img src="http://cloud.github.com/downloads/malsup/cycle/beach3.jpg" width="200" height="200" />
</div>
</div>
js:
$(function() {
$('#slideshow').cycle({
fx: 'turnDown',
speed: 'fast',
timeout: 3000,
pager: '#nav',
slideExpr: 'img'
});
});
How can I add current active class to current img? like <img class='active
>
Upvotes: 2
Views: 4430
Reputation: 98758
$('#slideshow').cycle({
after: function(el, next_el) {
$(next_el).addClass('active');
},
before: function(el) {
$(el).removeClass('active');
}
});
Upvotes: 6