jQuery Cycle plugin pagerAnchorBuilder images becoming undefined

与世无争的帅哥 提交于 2019-12-01 11:19:04
Luca Filosofi

Read this may help you!

jQuery Cycle pagerAnchorBuilder

Sal

I used JQuery.find() to help find the images, and to keep the code modular enough to use with different markup:

pagerAnchorBuilder: function(idx, slide) {
    return '<li><a href="#"><img src="'
        + jQuery(slide).find('img').attr('src')
        + '" width="120" /></a></li>'; 
}
redplanet

With reference to JVerstry's comment (nice one JV btw!), I got the following going just fine which uses the image and <a>link. Also the pager thumbs also show the main image alt attribute:

return '<li class="slider-thumb"><a href="'+slide.href+'" id="pager-click" title="'+slide.title+'"><img src="'+ $(slide).find('img').attr('src')+'" width="90" height="69" class="fader" /></a><p class="slide-caption">'+ $(slide).find('img').attr('alt')+'</p></li>';

Seems to be a common problem! Check out cycle with anchors and also cycle's "slideExpr"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!