Cycle Plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cycle Plugin

meeesta
Hello.

I'm quite new to JQuery and still finding my feet, but I too am having issues with the HTMLDivElement object. In my example I have a variable holding a chunk of html, I can use childNodes, and have indeed managed to find an image within the html and collect it's .src .

So I thought getting a class value from the parent DIV would be easy. I've tried slide.attr(class) or checking to see if a specific class is present slide.hasClass("hori"); , both to no avail. I know I'm not interpreting the DOM manipulation right, and if anyone has any starting points that'd be greatly appreciated.

I'm using http://malsup.com/jquery/cycle/ , and this is the bit of code that's tripping me up:

<script type="text/javascript"> $(function() { $('#imageContent').cycle({ fx: 'fade', speed: 800, timeout: 5000, pager: '#imageNavigation', pagerAnchorBuilder: function(idx, slide) { /* At this point I want to see the class of the DIV contained within the slide object. So I can tweak how the generated thumbnails are displayed by attaching the class collected from slide html and applying it to the generated thumbnails */ var childNodeArray = slide.childNodes; var selectedNode; if (childNodeArray[0].src) {selectedNode = childNodeArray[0].src} else {selectedNode = childNodeArray[1].src} return '<li><a h ref="#"><img src="' + selectedNode + '" /></a></li>'; } }); }); </script>
To help clarify, this is the html contained within the slide variable :
<div class="hori">
     image
     <p>Image Caption</p>
</div>


Regards,
Meeesta