Skip to content
Snippets Groups Projects

Issue #3484065 by grimreaper, pdureau: Carousel item: remove active prop,...

Merged Florent Torregrosa requested to merge issue/ui_suite_bootstrap-3484065:3484065-5-0-x into 5.0.x
5 files
+ 33
12
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 26
0
 
((Drupal, once) => {
 
Drupal.ui_suite_bootstrap_carousel = Drupal.ui_suite_bootstrap_carousel || {};
 
 
/**
 
* Set active class on the first item.
 
*
 
* @type {Drupal~behavior}
 
*
 
* @prop {Drupal~behaviorAttach} attach
 
* Attaches the behaviors for the active class.
 
*/
 
Drupal.behaviors.ui_suite_bootstrap_carousel = {
 
attach(context) {
 
once('carousel-active', '.carousel', context).forEach((carousel) => {
 
const items = carousel.querySelectorAll(
 
'.carousel-inner .carousel-item',
 
);
 
if (items.length === 0) {
 
return;
 
}
 
 
items.item(0).classList.add('active');
 
});
 
},
 
};
 
})(Drupal, once);
Loading