Lightbox click on the external image to close

I asked the author, but he told me to add the contributions I want through Github, and I don’t know how to do this, since I am not so versed in JavaScript. Hope you can all help. :)

Here's a link to the plugin: http://brutaldesign.imtqy.com/swipebox/

Basically, how can I make the lightbox close by clicking anywhere outside the image? How do most lightboxes work?

This lightbox works fine the way I want it: http://fancyapps.com/fancybox/ I do not use this lightbox because it does not have the swipe functionality that I need.

I know this should be related to the following function

.click 

Thanks in advance!

+4
source share
1 answer

(updated with more events and better events)

Try adding a script to your page

 <script> $(function(){ $(document.body) .on('click touchend','#swipebox-slider .current img', function(e){ return false; }) .on('click touchend','#swipebox-slider .current', function(e){ $('#swipebox-close').trigger('click'); }); }); </script> 
+7
source

All Articles