Reputation: 494
I am currently working with the Galleria js Slider.
I need callback to event when a user tries to view slide images 6>
I want to bar users from seeing slide 6 and above and display a popup when he clicks on 6> thumbnails or the forward arrow.
Apologies for my poor Engish.
Can anyone help. Thanks in advance.
I've tried
var gallery = Galleria.get(0);
gallery.bind("loadfinish", function(e) {
if (e.index > 5) {
myCallback();
return false; // Here I need to prevent image showing
}
});
Solution:
var selector = '#galleria-1';
Galleria.run(selector);
$(selector).data('galleria').bind('loadfinish', function(e) {
if(e.index > 4) { // > the fifth image
$(selector +' .galleria-image img').css('opacity', 0);
this.show( 0 );
myCallback();
}
})
Upvotes: 0
Views: 50
Reputation: 108500
Try something like:
Galleria.on('loadstart', function(e) {
if(e.index == 5) {
alert('6th image!');
}
})
http://galleria.io/docs/api/events/#loadstart
Upvotes: 1