Forum Moderators: open

Message Too Old, No Replies

How to get captions in jCarouel lite (a jQuery script)?

         

Darkelve

10:43 am on May 22, 2010 (gmt 0)

10+ Year Member



I'm quite new to Ajax and needed a vertically scrolling image gallery, managed to set up jCarousel Lite.

But except for the image I also would like to have a caption below each image (a link with a description of the photo), that also scrolls as the image scrolls.

Code for the HTML:


<div class="carousel">
<ul>
<li><a href="#anchor"><img src="images/image1.jpg" width="193" height="121" alt="myimage" /></a></li>
<li><a href="#anchor"><img src="images/image2.jpg" width="193" height="121" alt="myimage" /></a></li>
<li><a href="#anchor"><img src="images/image3.jpg" width="193" height="121" alt="myimage" /></a></li>
<li><a href="#anchor"><img src="images/image4.jpg" width="193" height="121" alt="myimage" /></a></li>
<li><a href="#anchor"><img src="images/image5.jpg" width="193" height="121" alt="myimage" /></a></li>
<li><a href="#anchor"><img src="images/image6.jpg" width="193" height="121" alt="myimage" /></a></li>
</ul>
</div>


Code for the jQuery call:
<script type="text/javascript">
$(".carousel").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev",
visible: 3

});
</script>


Any ideas? Maybe adding a span right after the <a> tags, then using some CSS trickery to position them below the images. Or some jQuery function? (alas, I'm not very good at Ajax, just starting out with it).

Tommybs

7:36 pm on May 29, 2010 (gmt 0)

10+ Year Member



It looks as though the functionality should be provided by jcarouselLite. Your best bet might be to give all the <a> tags a specific class with a position:relative; set. You can then absolutely position each <span> of text to the bottom of the <a> tag and give it a higher z-index then the <img> so that it sits on top of it. Of course this might through up some more style issues that will need fixing.