I have this js function
$('#galleria').galleria({
show:<?php echo $show;?>,
autoplay: 3000,
extend: function(options) {
var gallery = this; // "this" is the gallery instance
this.bind('image', function(e) {
var curr = gallery.getData(gallery.getIndex());
var currOrig = curr.original;
var altTxt = $(currOrig).attr('alt');
$(e.imageTarget).attr('alt',altTxt);
});
this.bind('thumbnail', function(e) {
var thumb = gallery.getData(e.index);
var thumbOrig = thumb.original;
var altText = $(thumbOrig).attr('alt');
$(e.thumbTarget).attr('alt',altText);
});
}
})
Basicaly this is free image galery. The code above must be included right after the html with images according to the owner instructions: http://galleria.io/
The problem is that this function recreates new elements from the html and it does it for different time each time the page is loading. The time needed for the js script vary because each page that use this gallery js has different number of images so different time for execution. I need to run another function:
load_img_comments('<?php echo $image;?>','<?php echo $imagename;?>','','i');
which takes a element from the ready html and does something with it. If I set this function to run on document ready or onload the function can not find the element because the first function is still working on the html. I tried to delay the execution for secong js function but as I explained above each page has different number of images and I can not predict how many time the first function will need to ends.
How can I circle this stupid situation?
Please advise. P.S.
I also tried this:
$(document).bind($('#galleria').galleria({
show:<?php echo $show;?>,
autoplay: 3000,
extend: function(options) {
var gallery = this; // "this" is the gallery instance
this.bind('image', function(e) {
var curr = gallery.getData(gallery.getIndex());
var currOrig = curr.original;
var altTxt = $(currOrig).attr('alt');
$(e.imageTarget).attr('alt',altTxt);
});
this.bind('thumbnail', function(e) {
var thumb = gallery.getData(e.index);
var thumbOrig = thumb.original;
var altText = $(thumbOrig).attr('alt');
$(e.thumbTarget).attr('alt',altText);
});
}
}), load_img_comments('<?php echo $image;?>','<?php echo $imagename;?>','','i'));
but it returns error: TypeError: r.push is not a function in main jquery.js file
Thank you in advance !