3 Replies - 2710 Views - Last Post: 02 January 2014 - 05:39 AM

#1 Bluezap   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 440
  • Joined: 19-January 12

Lightbox setup on page

Posted 02 January 2014 - 01:00 AM

Hey, I'm not sure if any of you are familiar with this lightbox plugin but here is the link
[url]http://ilightbox.net/[/url]
The issue is that to implement ilightbox, for every image you have to place multiple javascript codes like this
         
   <script>
  $('#ilightbox1').iLightBox();
	</script>
    
    <script>
  $('#ilightbox2').iLightBox();
	</script> 
    
    <script>
  $('#ilightbox3').iLightBox();
	</script>
    

and call it by using id="ilightbox1" and so on for every other image
Isn't there away to just create a class and call it for every image like how fancybox is implemented?
<script type="text/javascript">
	$(document).ready(function() {
		$(".fancybox").fancybox();
	});
</script>


And just call it from class="fancybox" ?

Is This A Good Question/Topic? 0
  • +

Replies To: Lightbox setup on page

#2 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Lightbox setup on page

Posted 02 January 2014 - 05:01 AM

I suspect you could do this - did you try it? Of course, continuing to read the documentation would be best.

At worst you could do something like this:

<script type="text/javascript">
	$(document).ready(function() {
		$(".yourclass").each(function () {
                    $(this).iLightBox();
                });
	});
</script>

Was This Post Helpful? 1
  • +
  • -

#3 Bluezap   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 440
  • Joined: 19-January 12

Re: Lightbox setup on page

Posted 02 January 2014 - 05:27 AM

using
<script type="text/javascript">
	$(document).ready(function() {
		$(".ilightbox").iLightBox();
	});
</script>


Causes all images with the class to form into one big gallery.
But by using what you provided above I was able to separate them into individual images
Thank you.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Lightbox setup on page

Posted 02 January 2014 - 05:39 AM

No problem.

(I've moved this to the jQuery forum.)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1