Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!

stefanvd priority asked 1 year ago


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 1 year ago


stefanvd priority answered 1 year ago


Thank you very much!

Kind regards, Stefan


stefanvd priority answered 1 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>).



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Priority
  • 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