[UPDATED] JonDesign’s SmoothGallery Shadowbox plugin

3 minute read

Hi there,

very little and fast post about this plugin. Today i had to make SmoothGallery to work with Shadowbox plugin (rather than Lightbox) and within an extreme surprise i didn’t found nothing on the web. So i had to do it myself. I thought it would be much difficult, but in fact it was really easy to fix it. So here, i’m sharing this with you, if you had also my problem.

To make it work just replace at line 116

this.currentLink.rel = 'lightbox';

with

this.currentLink.addEvent('click',function(e){
 Shadowbox.open({
  content:e.target.href,
  player:'img',
  title:e.target.title
 });
 e.preventDefault()
});

and that’s it!

This method works with JonDesign’s SmoothGallery v2.0 + Shadowbox 3.1.3. Maybe it will work also with next versions of each other, but i don’t know, we will see it.

Hope you’ll enjoy this post :)

UPDATE! Found the method to make it work also on v2.1! (useful if you use jQuery and MooTools, all together).

Replace lines 133-136

this.currentLink = new Element('a').addClass('open').setProperties({
 href: '#',
 title: ''
}).injectInside(element);

with

this.currentLink = new Element('a').addClass('open').setProperties({
 href: '#',
 title: ''
}).injectInside(element).addEvent('click',function(e){
 Shadowbox.open({
  content:e.target.href,
  player:'img',
  title:e.target.title
 });
 e.preventDefault()
});

That’s it! Enjoy :)

Leave a Comment