When I place 2 instances of the Mega Slider in the same page, it only shows me the first.
Thu, 08/09/2018 - 20:50
#1
Multiple instances of the Mega Slider D8
Hello,
Because those sliders share the same ID, so only the first slider displays. You can follow one of the two solutions below:
Solution 1: In page admin/structure/md-slider, please clone slider. Then there is another block slider and you can assign to any region. Then, your sliders will have different ID and they can all be shown
Solution 2: Open file md_slider/assets/js/frontend/init-md-slider.js and replace:
$.each(drupalSettings.md_slider, function(slid, slider) {
listMegaSlide[i] = $('#md-slider-' + slid + '-block').mdSlider(slider);
if(slider.device_enable){
cssInline += '@media (max-width: ' + slider.device_width + 'px) {\
#md-slider-' + slid + '-block .md-objects {\
display: none;\
}\
} ';
}
if(slider.device_width){
cssInline += '@media (max-width: ' + slider.device_width + 'px) {\
.hideonmobile {\
display: none !important;\
}\
}';
}
i++;
});
with:
$('.md-slide-items').each(function(){
var slid = $(this).attr('id').split('-')[2],
slider = drupalSettings.md_slider[slid];
listMegaSlide[i] = $(this).mdSlider(slider);
if(slider.device_enable){
cssInline += '@media (max-width: ' + slider.device_width + 'px) {\
#md-slider-' + slid + '-block .md-objects {\
display: none;\
}\
} ';
}
if(slider.device_width){
cssInline += '@media (max-width: ' + slider.device_width + 'px) {\
.hideonmobile {\
display: none !important;\
}\
}';
}
i++;
});
Hello this does not work, I have 2 regions each with a different slider block and it only shows me the firstI tried your second opcion
Hello,
Did you clear Drupal cache?
Please send us your site url and admin account to check this issue