I want to add a class to the current slide's link. My javascript code is
$(document).ready (function() {
$('#slideshow').cycle({
fx: 'fade',
speed: 500,
timeout: 1000,
pause: 1,
cleartype: true,
cleartypeNoBg: true,
pager: '#forpager',
pagerAnchorBuilder: function(idx, slide) {
return '#forpager li:eq(' + (idx) + ')';
}
});
$('#forpager ul li a').click(function(){
$('#forpager ul li a').removeClass("active");
$(this).addClass("active");
});
});
And the html code for slideshow is
<div id="forslideshow">
<div id="slideshow">
<div class="image">
<center><img src="images/pic1.jpg" alt="Renny"/></center>
</div>
<div class="image">
<center><img src="images/pic2.jpg" alt="Giselle"/></center>
</div>
<div class="image">
<center><img src="images/pic3.jpg" alt="Emma Goldman"/></center>
</div>
</div>
<div id="forpager">
<ul>
<li ><a href="#"><img src="images/menupic.png"/></a></li>
<li ><a href="#"><img src="images/menupic.png"/></a></li>
<li ><a href="#"><img src="images/menupic.png"/></a></li>
</ul>
</div>
</div>
Problem is that with this code when I click on a particular link that slide comes and link has the active class but else as the slides cycle their corresponding links are not don't have active class. Can anyone give me code which can add/change the class of links as the slide show starts and when i am not clicking on the links.