2010-06-23 23 views
0

有真正的问题从活动循环幻灯片获取alt attr?我应该使用'opts'来得到这个吗?我不能得到幻灯片标题,ccle jQuery

欢迎光临!

$("div.backgroundImages").fadeIn(200).cycle({   
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
      timeout: 0, 
      containerResize: false, 
      speed: '450', 
      height: '1000', 
      slideExpr: 'div.backgroundSlide', 
      next : 'div.backgroundImages', 
      before: onBefore, 
     after: onAfter 
    }); 

    function onBefore(curr, next, opts){ 

    } 

    function onAfter(curr, next, opts){ 
     $('span.title').html(opts.currSlide.alt); // doesn't work?! 

     var cnt = 'Image ' + (opts.currSlide + 1) + ' of ' + opts.slideCount; // works 
     $('span.cnt').html(cnt); 
    } 

回答

0

AGH - 这只是因为我没有指定图像的幻灯片!

slideExpr: 'div.backgroundSlide', 
0

确定 - 不是最好的soltion BT

$('div.title').html($('div.backgroundSlide:visible img').attr("alt")); 

是怎么弄到arond它。奇如何正确的方法不会工作....