Beginner question


Topic: Beginner question

stefanvd pro premium priority asked a 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!


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

Thank you very much!

Kind regards, Stefan


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
  • 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