.on(“ended”) fires multiple times
I've actually posted his on stackoverflow already, you can check it out here for the long version: http://stackoverflow.com/questions/19390188/bigvideo-js-onended-fires-multiple-times
Short version:
When .on(“ended”) event is triggered, it seems to go through some sort of queue and fire multiple times. If I console.log num like that:
function setupAnimation(num) {
console.log(num);
BV.getPlayer().on("ended", function () {
$('#anim0' + num).animate({ opacity: 1 });
});
}
I get a single expected value for num. But if I do it like that:
function setupAnimation(num) {
BV.getPlayer().on("ended", function () {
console.log(num);
$('#anim0' + num).animate({ opacity: 1 });
});
}
Then I get multiple values for num each time this function is called. That's why several animations on the page are animating instead of just one at the end of the video (more context provided on stackoverflow). Console.log() returns more and more values if the function is getting called again, as if .on("ended") creates some sort of queue or array and loops through it.
I can't figure out that part from looking at the plugin's code and I'm trying to figure out if this is a bug or expected behavior.