stopping jQuery lightbox from grouping images?

Discussion in 'jQuery' started by wolfestone, Feb 25, 2009.

  1. #1
    I'm using Jquery lightbox, and from the documentation, some ways to call it are below.

    I have several lightboxes on one page, but they're not related so I don't want it to group the images. I've achieved what I want to do by inserting multiple scripts at the top of the page, all looking for a different "rel=" parameter.

    But, I know there's got to be a cleaner way to do it.

    Any suggestions?


    <script type="text/javascript">
    $(function() {
    	// Use this example, or...
    	$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
    	// This, or...
    	$('#gallery a').lightBox(); // Select all links in object with gallery ID
    	// This, or...
    	$('a.lightbox').lightBox(); // Select all links with lightbox class
    	// This, or...
    	$('a').lightBox(); // Select all links in the page
    	// ... The possibility are many. Use your creative or choose one in the examples above
    });
    </script>
    Code (markup):
     
    wolfestone, Feb 25, 2009 IP
  2. wayfarer07

    wayfarer07 Peon

    Messages:
    34
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How about this?
    
    $('a[rel="lightbox"]').each(function() {
         $(this).lightBox();
    });
    
    Code (markup):
     
    wayfarer07, Mar 10, 2009 IP