I want to add 'onclick' functionality to certain elements. These elements are perfectly targeted with this CSS, setting pointer-events to 'auto':
.custom-collections .o_slideshow .end-group {
pointer-events: auto;
}
.custom-collections > .o_slideshow:first-child,
.custom-collections > .o_slideshow .o_slide[data-id="home_slide"],
.custom-collections > .o_slideshow:last-child {
pointer-events: auto;
}
My javascript currently enables the elements to be dragged (on drag) and previewed (on long touch). Ultimately, I need it only to be previewed.
In the javascript, I include this, to disable drag functionality if 'defaultSlide' is one of the classes:
if (event.target.classList.contains('defaultSlide')) {
// If the slide contains 'defaultSlide', it shouldn't be draggable.
return;
}
How should I append the class defaultSlide
to the elements?
Alternatively, what else could I do, instead of an if class
method, to have my drag-script return immediately?
Normally, I would add the class 'defaultSlide' to these elements in javascript when the elements are first created, but that requires a lot of code in my context of bad legacy code