jQuery循环插件如何添加活动类
示例: http : //jsfiddle.net/kuTLf/
代码看起来像这样:
JS:
$(function() { $('#slideshow').cycle({ fx: 'turnDown', speed: 'fast', timeout: 3000, pager: '#nav', slideExpr: 'img' }); });
如何将当前活动类添加到当前img? 喜欢<img class='active
>
$('#slideshow').cycle({ after: function(el, next_el) { $(next_el).addClass('active'); }, before: function(el) { $(el).removeClass('active'); } });
这是一个快速演示 ,了解哪个是活动的。
function onAfter1(curr,next,opts) { currentSlide = $(".thePager a.activeSlide").html(); if(!currentSlide) currentSlide = "1"; $('.slideCaption').html(currentSlide + '/' + opts.slideCount); }