Skip to content
Discussion options

You must be logged in to vote

My solution was to calculate an offset based on the number of slides in the slider.

const options = {
  containScroll: false,
  loop: true,
  align: (viewSize, snapSize, index) => {
    console.log(viewSize, snapSize, index);
    let slideElement = document.querySelector('.embla__slide');
    let slideCount = document.querySelectorAll('.embla__slide').length;
    let slideWidth = slideElement.offsetWidth;
    let slideNumber = viewSize / slideWidth;

    if (slideCount < slideNumber) {
      // Get all elements with the class 'embla__button'
      const buttons = document.querySelectorAll('.embla__button');

      // Iterate over each button and set its display style to 'none'
      buttons.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@leebaroneau
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by davidjerleke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
resolved This issue is resolved question Question about how to achieve something
3 participants