pepelsbey / darkbox

Simple but powerful jQuery plugin for viewing images
http://pepelsbey.github.com/darkbox/
79 stars 12 forks source link

Calling .darkbox() multiple times #6

Closed nashbridges closed 12 years ago

nashbridges commented 13 years ago

Hi! I've modified script to handle situations when it's necessary to call the .darkbox() on the different element sets several times. Typical use case would be:

  1. "Darkboxifing" links that is not currently in the DOM and pulled in via AJAX.
  2. Creating image galleries on the top of "darkboxified" images while leaving some stand-alone ones. For example,
$(".gallery").darkbox().darkboxgallery();```
In such cases Darkbox container will be created only once, but it'll be still possible to set detached settings for the each group.
```$("#alone").darkbox({imageFadeInTime: 1000});
$(".gallery").darkbox({imageFadeInTime: 0}).darkboxgallery();```
It's possible to change close button title on a first .darkbox() call:
```$( 'a[rel=darkbox]' ).darkbox({closeButtonTitle: "Закрыть"});```

I've tried to keep current logic and names convention. The only thing I changed was darkboxButton -> closeButton (CSS remained the same) as I thought it's not semantic. Но это уже вам решать :)