question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore <template> slide elements

See original GitHub issue

I’m dynamically generating a list of slides (using AlpineJS x-for) before calling EmblaCarousel, however it seems like the <template> element is being picked up as a slide. My HTML structure looks like this:

<div class="embla">
  <ul class="embla__container">
    <template x-for="item in list"><li>...</li></template>

    <!-- dynamically generated -->
    <li class="embla__slide">...</li>
    <li class="embla__slide">...</li>
    <li class="embla__slide">...</li>
    <li class="embla__slide">...</li>
    <!-- end dynamically generated -->
  </ul>
</div>

I’m now manually creating this list for the time-being, but is there any way to ignore the <template> when creating an instance of Embla?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
davidjerlekecommented, Dec 14, 2021

@hannahwoodward I’m going to mark this issue as resolved because this solution makes it possible to achieve what you want.

Please let me know if you don’t agree.

1reaction
davidjerlekecommented, Dec 9, 2021

Hi @hannahwoodward,

FWIW, decades later, I want to let you know that it’s possible to provide your own slides from v6 and up.

const embla = EmblaCarousel({ rootNode, containerNode, slideNodes }, options)

👉 Please note:

  • rootNode is mandatory when passing an object with element nodes instead of a single element node.
  • if containerNode is omitted, Embla will pick the first immediate child inside the rootNode.
  • slideNodes has to be an array and not a nodeList.
  • It’s your responsibility to make sure that any elements inside the container that aren’t slides don’t take up any space.

Best David

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize a slide master - Microsoft Support
Use a slide master to add consistency to your colors, fonts, headings, logos, and other styles, and to help unify the form of...
Read more >
How to Remove Elements from PowerPoint Templates
The following tutorial applies to PowerPoint 2019 and 365 and addresses how to remove elements from PowerPoint Templates using Slide Master.
Read more >
Ignore And No Communication Ppt Slide Design - SlideGeeks
Run your eyes over our Ignore And No Communication Ppt Slide Design. They will appeal at the first examination. Download this Presentation download....
Read more >
How-to: Create and customize the PowerPoint slide master
The core element: the master layout slide. At the heart of every PowerPoint template is the master layout slide. Adjustments to a master...
Read more >
How to Add, Duplicate, Move, Delete or Hide Slides in Google ...
... keeping the design included in the template. Or sometimes, you might prefer to duplicate an existing slide to reuse its elements, such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found