Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix carousel.js to support multiple list items #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fvdpol
Copy link

@fvdpol fvdpol commented Jan 8, 2025

The carousel code fails when the 1st slide contains more than one list elements.
This can be reproduced by updating the slogan.yaml:

weight: 1
title: "Moodle + Raspberry = MoodleBox"
description: >
  <ul class="list-style-none">
     <li>A small box on the table that brings Moodle to the entire classroom has a touch of magic!</li>
     <li>2nd line on 1st slide</li>
   </ul>
image: "/img/carousel/raspberry-pi-case.png"

This will raise a javascript runtime error:

carousel.js:16  Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Element': 'ol li:nth-last-child(-n + -29)' is not a valid selector.
    at carousel.js:16:30
    at NodeList.forEach (<anonymous>)
    at HTMLDocument.<anonymous> (carousel.js:7:13)
	

The fix in this PR will correct the selection appropriate element, allowing the use of multiple list items on the 1st slide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant