[jQuery] Re: Adding incremental numbered classes to divs

2009-04-14 Thread Eric Garside

I just finished documentation on a new plugin I think might help you
in this situation. Check out: http://eric.garside.name/docs.html?p=replicator

On Apr 13, 11:04 pm, Brain Lava nic...@brainlava.com wrote:
 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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-13 Thread Brain Lava

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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-13 Thread Brain Lava

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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread brian

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.



[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread Ralph Whitbeck
You can use .each to iterate through each div element and increment the
classname or ID via it's index.

$(div).each(function(i) {
$(this).addClass(classname + i);
});

http://docs.jquery.com/Core/each

HTH
Ralph


On Thu, Apr 9, 2009 at 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.
 



[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread Brain Lava

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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread Brain Lava

Thanks Ralph!  I'll give that a try :)

On Apr 9, 10:13 am, Ralph Whitbeck ralph.whitb...@gmail.com wrote:
 You can use .each to iterate through each div element and increment the
 classname or ID via it's index.

 $(div).each(function(i) {
     $(this).addClass(classname + i);

 });

 http://docs.jquery.com/Core/each

 HTH
 Ralph

 On Thu, Apr 9, 2009 at 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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread Eric Garside

What's the advantage of assigning the identifier to the class? Like,
how are you using it once you create the classes. I'm assuming there's
an easier solution, especially if you're doing it dynamically.

On Apr 9, 2:54 pm, Brain Lava nic...@brainlava.com wrote:
 Thanks Ralph!  I'll give that a try :)

 On Apr 9, 10:13 am, Ralph Whitbeck ralph.whitb...@gmail.com wrote:

  You can use .each to iterate through each div element and increment the
  classname or ID via it's index.

  $(div).each(function(i) {
      $(this).addClass(classname + i);

  });

 http://docs.jquery.com/Core/each

  HTH
  Ralph

  On Thu, Apr 9, 2009 at 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.


[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread Hector Virgen
Can you use an ordered list? li elements are block level just like divs.
-Hector


On Thu, Apr 9, 2009 at 1:46 PM, Eric Garside gars...@gmail.com wrote:


 What's the advantage of assigning the identifier to the class? Like,
 how are you using it once you create the classes. I'm assuming there's
 an easier solution, especially if you're doing it dynamically.

 On Apr 9, 2:54 pm, Brain Lava nic...@brainlava.com wrote:
  Thanks Ralph!  I'll give that a try :)
 
  On Apr 9, 10:13 am, Ralph Whitbeck ralph.whitb...@gmail.com wrote:
 
   You can use .each to iterate through each div element and increment the
   classname or ID via it's index.
 
   $(div).each(function(i) {
   $(this).addClass(classname + i);
 
   });
 
  http://docs.jquery.com/Core/each
 
   HTH
   Ralph
 
   On Thu, Apr 9, 2009 at 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.



[jQuery] Re: Adding incremental numbered classes to divs

2009-04-09 Thread mkmanning

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.