nicolafranchini/VenoBox

Callback not working (ex. init)

sibputnik opened this issue · 5 comments

Simple problem: none of callbacks are working, except "cb_init". You can see code below, also I takes code from example (for all events). In console I see "vb init" and never something else. Other functions working fine.

$('.venobox2').venobox({
	numeratio  : true,
	border     : '5px',
});
$('.venobox2').venobox({
	cb_post_open  : function(obj, gallIndex, thenext, theprev){
		console.log("vb open");			
	},
	cb_init: function(){
		console.log("vb init");
	}
});

<a href="/uploads/posts/2020-06/1592989292_1.jpg" class="venobox2 vbox-item" data-gall="gallery"><img data-src="/uploads/posts/2020-06/1592989292_1.jpg" alt="" class="fr-dii fr-padded lazy-loaded" src="/uploads/posts/2020-06/1592989292_1.jpg"></a>

jQuery 3

all callbacks are working fine, also with jQuery 3: https://jsfiddle.net/veno/0e7uayx1/9/

try removing the class vbox-item from your link, it is a class added by the plugin.

Thank you very match! Helped by using a single use of a function call. See above - I call .venobox 2 times

This code works:

$('.venobox2').venobox({
	numeratio  : true,
	border     : '5px',		
	cb_post_open  : function(obj, gallIndex, thenext, theprev){
		console.log("vb open");			
	},
	cb_init: function(){
		console.log("vb init");
	}			
});

Yes, I didn't noticed that. Once a link has been initialized the plugin sets a data-attribute to avoid multiple initializations.