Thanks everyone! You've definitely made some great points for me to consider. I'm really new to scripting (normally I can find plugins to do what I want) and you're probably right that there is a much easier solution to what I'm trying to achieve.
I'm going to take your suggestions and see what I can figure out on my own. If I can achieve the effect I'm desiring I'll post the end result for some feedback. Cheers! On Apr 9, 5:54 pm, mkmanning <michaell...@gmail.com> wrote: > Since you're not using the class for styling, but indexing, why not > just use the natural index of the div in its container, or from the > jQuery object itself? > > $('.ngg-gallery-thumbnail-box') is an array-like object, so you can > iterate over it, or access its members by index number, such as $ > ('.ngg-gallery-thumbnail-box').get(8). > > If you're building a carousel, adding incremental numbers to the > classname to drive the carousel seems overkill. > > On Apr 9, 11:54 am, Brain Lava <nic...@brainlava.com> wrote: > > > Normally I would agree with you but the effect I'm trying to achieve > > is based on the location of the image in the grid and not tied to the > > image itself. I don't want the end user to have to update the CSS > > every time they move an image or add a new one to their gallery. This > > seemed like the best way to achieve my end result. > > > On Apr 9, 9:37 am, brian <bally.z...@gmail.com> wrote: > > > > That seems like you're fighting against the convention. Why create a > > > zillion classes when these same divs already have an incremented ID? > > > (The ID being the proper place to do this sort of thin, in the 1st > > > place) > > > > On Thu, Apr 9, 2009 at 1:31 AM, Brain Lava <nic...@brainlava.com> wrote: > > > > > I'm really new to jQuery and have been struggling with a concept that > > > > I would think is pretty simple but I can't seem to find anything > > > > online that does what I need. > > > > > I'm using NextGen Gallery for Wordpress and I would like to assign an > > > > incremental class to each div that the gallery outputs. For example > > > > the gallery gives me the following code: > > > > > <div id="ngg-gallery-1" class="ngg-galleryoverview"> > > > > <div id="ngg-image-99" class="ngg-gallery-thumbnail-box"></div> > > > > <div id="ngg-image-55" class="ngg-gallery-thumbnail-box"></div> > > > > <div id="ngg-image-95" class="ngg-gallery-thumbnail-box"></div> > > > > </div> > > > > > What I would like to do is replace the append class of the interior > > > > divs with a number that automatically increments by 1: > > > > <div id="ngg-gallery-1" class="ngg-galleryoverview"> > > > > <div id="ngg-image-99" class="ngg-gallery-thumbnail-box-1"></div> > > > > <div id="ngg-image-55" class="ngg-gallery-thumbnail-box-2"></div> > > > > <div id="ngg-image-95" class="ngg-gallery-thumbnail-box-3"></div> > > > > </div> > > > > > I've seen this done in carousel scripts but I can't seem to figure out > > > > how they do it. > > > > > Any help would be greatly apprecaited.