|
|
|
@@ -1,16 +1,13 @@
|
|
|
|
|
import { Controller } from 'stimulus';
|
|
|
|
|
import 'owl.carousel2/dist/assets/owl.carousel.css';
|
|
|
|
|
import 'owl.carousel2/dist/assets/owl.theme.default.css';
|
|
|
|
|
import 'owl.carousel2';
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This is an example Stimulus controller!
|
|
|
|
|
*
|
|
|
|
|
* Any element with a data-controller="hello" attribute will cause
|
|
|
|
|
* this controller to be executed. The name "hello" comes from the filename:
|
|
|
|
|
* hello_controller.js -> "hello"
|
|
|
|
|
*
|
|
|
|
|
* Delete this file or adapt it for your use!
|
|
|
|
|
* owl.carousel2 is a legacy jQuery plugin that reads `window.jQuery` at module
|
|
|
|
|
* evaluation time. When statically imported it lands in the eager shared chunk,
|
|
|
|
|
* and depending on webpack chunk ordering it can evaluate before jQuery is ready,
|
|
|
|
|
* throwing and breaking the whole Stimulus bootstrap. Load it lazily inside
|
|
|
|
|
* connect() so it can never break unrelated controllers (e.g. registration).
|
|
|
|
|
*/
|
|
|
|
|
export default class extends Controller {
|
|
|
|
|
static targets = ["showid"];
|
|
|
|
@@ -18,6 +15,7 @@ export default class extends Controller {
|
|
|
|
|
connect() {
|
|
|
|
|
var slideshow = this.element;
|
|
|
|
|
|
|
|
|
|
import('owl.carousel2').then(function() {
|
|
|
|
|
$(slideshow).owlCarousel({
|
|
|
|
|
nav: true,
|
|
|
|
|
margin: 15,
|
|
|
|
@@ -42,6 +40,10 @@ export default class extends Controller {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
slideshow.classList.remove('hide');
|
|
|
|
|
}).catch(function(e) {
|
|
|
|
|
console.warn('owl.carousel failed to load', e);
|
|
|
|
|
slideshow.classList.remove('hide');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
slideshow.querySelectorAll('.show-msg').forEach(function (el) {
|
|
|
|
|
el.addEventListener('click', function (evn) {
|
|
|
|
|