mardi 22 décembre 2020

How to wrap my whole code in flickity js into a function?

I cannot find any tutorials on how to modify this flickity js code. I am completely new with vanilla js and I admit that I do not have good knowledge with it. This is my code but the flickity slider is not working anymore when I wrapped the whole code into a function.

const slider = () => {
  new Flickity( '.slider', {

    cellAlign: 'left',
    draggable: true,
    contain: true,
    wrapAround: true,
    autoPlay: 2000,
    arrowShape: { 
      x0: 10,
      x1: 60, y1: 50,
      x2: 65, y2: 45,
      x3: 20
    }
  });  
}

export default slider



Aucun commentaire:

Enregistrer un commentaire