Topic: Beginner question
Hi!
I have a beginner question. I use the Multi carousel plugin and would like to change options in JS or jQuery, let's say 4 images instead of the default of 3. Not with data attributes but with JS or jQuery. The documentation says:
Options
Options can be passed via data attributes, JavaScript, or jQuery. For data attributes, append the option name to data-mdb-, as in data-mdb-interval="".
And then for example the amount of items: items -- Number / String -- 3 -- Defines number of visible items.
My question:
How can I set this option in my JS?
I tried:
const multiCarousel = document.getElementById('carousel'); const multiCarouselInstance = MultiCarousel.getInstance(multiCarousel); multiCarouselInstance.items(4);
And I tried:
$('#carousel').multiCarousel({ items: 5, });
This is giving the error:
Uncaught TypeError: $(...).multiCarousel is not a function
Thanks!
Kamila Pieńkowska staff answered a year ago
I've prepared a snippet for you: https://mdbootstrap.com/snippets/standard/kpienkowska/5736275
stefanvd pro premium priority answered a year ago
In addition,
the carousel is working fine, so I assume that I added the needed scripts correctly,
they are in the DOM, (before the </body>
).
stefanvd pro premium priority answered a year ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.4.2
- Device: pc
- Browser: chrome
- OS: win10
- Provided sample code: No
- Provided link: No