// Load the animation "name" in container
load: function (name, container, replace) {
let json = this.quiz.data.animations[name];
- $.each(replace, function (k, v) {
- json = json.replace(new RegExp(k, 'g'), v);
+ if(json) {
+ $.each(replace, function (k, v) {
- console.log(k, v);
+ json = json.replace(new RegExp(k, 'g'), v);
- });
+ });
- lottie.loadAnimation({
- container: $(container).get(0),
- renderer: 'svg',
- loop: false,
- autoplay: true,
- animationData: JSON.parse(json),
- });
+ lottie.loadAnimation({
+ container: $(container).get(0),
+ renderer: 'svg',
+ loop: false,
+ autoplay: true,
+ animationData: JSON.parse(json),
+ });
+ }
}
}