Cycle plugin, Targeting Child Element
Hi, I'm customizing the cycle plugin a bit from
http://malsup.com/jquery/cycle/
, which slides through a number of items.
The issue I have is selecting a child object, to get its 'alt' attribute, and display it as a description. Using the default example:
-
function onBefore() {
$('#output').html("Scrolling image:<br>" + this.alt );
}
...works great when each item is an image. But I need to link each element, so my markup looks like this:
-
<div id="slideshow1" class="pics">
<a href="portfolio.html" title="Go to Project"><img src="tree.jpg" width="200" height="200" class="featuredimage" alt="Tree Branches" /></a>
<a href="portfolio.html" title="Go to Project"><img src="paint.jpg" width="200" height="200" class="featuredimage" alt="Worn Down Paint" /></a>
<a href="portfolio.html" title="Go to Project"><img src="boat.jpg" width="200" height="200" class="featuredimage" alt="Old Boat" /></a>
</div>
I'm not sure how to get the child element's alt attribute. I've searched through jQuery documentation and googled around, but can't get it working.
Any help appreciated. Thanks.