[jQuery UI] prevent from calling a constructor more than once time?
Hello everyone! This is my first post on this forum. :)
I'm creating my own lightbox. Underlying markup has following pattern:
If a picture doesn't belong to a gallery simply use:
<a href="link_to_image" title="optional_title><img src="optional_image" /></a>
If you want images constitute a gallery, you simply add common gallery name, following the pattern (changable in options), e.q "lb_galleryName". "lb_" prefix as I mentioned is configurable, you can change it if you like.
So, if you want 3 images belong to gallery called foo, simply add this markup:
<a href="link_to_image#1" class="lb lb_foo">image#1</a>
<a href="link_to_image#2" class="lb lb_foo">image#2</a>
<a href="link_to_image#3" class="lb lb_foo">image#3</a>
Class "lb" is just for filtering out normal links.
OK. So I don't need to call my rlightbox plugin twice on a page.
Since gallery names are in the scope of plugin, not $ui.rlightbox.gallery, invoking plugin more times than once could create confusing results.
My question is whether such singleton solution is good and if so, how to implement it as easily as possible? Maybe the solution is only to warm users in documentation? What's your opinion?
thanks in advance :)