[jQuery] Need Help with :eq()
Hi All,
I'm modifying Leandrovera's Lightbox plugin (http://leandrovieira.com/
projects/jquery/lightbox/) to display descriptions in a Joomla based
image gallery. I'm having some issues with getting the right count.
The following is shortened excerpt of the code generated from (http://
axia.entrecerebro.com/image-gallery2/):
<div class="jg_catelem_txt">
<ul>
<li>
<b>Algoa Radio - South Africa</b>
</li>
<li>
Description: Algoa Radio 1
</li>
<li>
<a href="# onMouseOver="return overlib('Click to
download the image.', CAPTION, 'Download', BELOW, RIGHT);"
onmouseout="return nd();">
<img src="#" alt="Download" class="pngfile jg_icon" />
</a>
</li>
</ul>
I'm using the following code to grab the LI:
var nextDesc = $("li:contains('Description'):eq(1)").show();
I'm new to Javascripting so I'm having issues with creating an
accurate count.
The entire function is:
function _show_image_data() {
// Finds Next List Item Containing "Description"
var nextDesc = $("li:contains('Description'):eq(1)").show();
$('#lightbox-container-image-data-box').slideDown('fast');
$('#lightbox-image-details-caption').hide();
if ( settings.imageArray[settings.activeImage][1] ) {
$('#lightbox-image-details-caption').html(settings.imageArray
[settings.activeImage][1]).show().append(nextDesc);
}
// If we have a image set, display 'Image X of X'
if ( settings.imageArray.length > 1 ) {
$('#lightbox-image-details-currentNumber').html(settings.txtImage
+ ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' +
settings.imageArray.length).show();
}
}
The code can be seen in its full context at:
http://axia.entrecerebro.com/image-gallery2/components/com_joomgallery/assets/js/lightbox2/js/jquery.lightbox-0.5.js
Any help would be greatly appreciated. Thanks in advance for any
insight and knowledge that you can pass on.
~Matt