Question about jquery.cycle plugin
Hello. Sorry if this question is too simple, but I can't find a way to solve this problem by my own
I am using jquery.cycle plugin in this way:
- $('#myCycleDiv').cycle({ fx: 'fade', speed: 'slow', startingSlide:1, timeout: 0, pager: '#nav', pagerAnchorBuilder: function(idx, slide) { return '<li><a href="#">' + slide.title + '</a></li>'; } });
As you can see cycle creates a list of links with slides titles. Cycle is sliding DIVs. HTML looks like:
- <div id="myCycleDiv">
- <div title="First Slide">...</div>
- <div title="Second Slide">...</div>
- <div title="Third Slide">...</div>
- </div>
It is not very comfortable, because when I use "title" tag browsers shows default yellow title block above every titled DIV on mouseover. So I decided not to use title tag and rewrote my HTML:
- <div id="myCycleDiv">
- <div><span class="title">First Slide</span> ... </div>
- <div><span class="title">Second Slide</span> ... </div>
- <div><span class="title">Third Slide</span> ... </div>
- </div>
So the question is: how to get span.title text from my slides?
I've tried this way, but it doesn't work:
- $('#myCycleDiv').cycle({ fx: 'fade', speed: 'slow', startingSlide:1, timeout: 0, pager: '#nav', pagerAnchorBuilder: function(idx, slide) { var divTitle = slide.find('span.title').text(); return '<li><a href="#">' + divTitle + '</a></li>'; } });
"slide" variable in pagerAnchorBuilder function returns DOMelement so why it doesn't work at all?
Help me please.