I am trying to make work Flickity Carousel by initing in blaze helpers. I do have following error:
Exception in template helper: TypeError: $(...).flickity is not a function
Here is my helper for the carousel template:
Template.carouselTemplate.onCreated(function bodyOnCreated() {
this.state = new ReactiveDict();
Meteor.subscribe('albums');
})
Template.carouselTemplate.helpers({
albums() {
return Albums.find({});
},
initializeCarousel () {
$('.carousel').flickity({
// options
"lazyLoad": true
});
}
});
And the template itself:
<template name='carouselTemplate'>
<div class="carousel">
{{#each albums}}
<div class="carousel-cell">
<img src={{cover}} alt="cat nose" />
</div>
{{/each}}
{{initializeCarousel}}
</div>
<template />
P.S: I am open for other ways in order to make this work.