Reputation: 327
I asked the author this but he said for me to add the contributions I want via Github, and I don't know how to do that as I'm not that knowledgeable with JavaScript. Hope you all can help. :)
Here's the link to the plugin: http://brutaldesign.github.io/swipebox/
Basically, how could I make the lightbox close by clicking anywhere outside the image? Like how most lightboxes function?
This lightbox does it perfectly how I want it: http://fancyapps.com/fancybox/ I dont use that lightbox because it doesn't have the swipe functionality that I need.
I do know it has to be something to do with the following function
.click
Thanks in advance!
Upvotes: 4
Views: 4624
Reputation: 195982
(updated with more events and better event delegation)
Try adding the following 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>
Upvotes: 8