I am using a color swatch plugin, here, which defines a custom Vue element.
I also followed this example to implement a JavaScript-baed scrollbar.
My .vue file is as follows:
<script> element:
export default {
name: "ProjectTask",
data: function() {
return { }
},
methods:
.
.
.
.
,
mounted() {
const rightBtn = document.querySelector('#right-button');
const leftBtn = document.querySelector('#left-button');
rightBtn.addEventListener("click", function(event) {
const conent = document.querySelector('#content');
conent.scrollLeft += 300;
event.preventDefault();
});
leftBtn.addEventListener("click", function(event) {
const conent = document.querySelector('#content');
conent.scrollLeft -= 300;
event.preventDefault();
});
}
}
<templete> element:
<div class="leftScroll" >
<button id="left-button"> swipe left </button>
</div>
<div class="ColorsWraper2 col-lg-8" id="content">
<swatches v-model="Project.color" :colors="color_picker" shapes="circles" inline></swatches>
</div>
<div class="rightScroll">
<button id="right-button"> swipe right </button>
</div>
<style> element:
.ColorsWraper2 {
white-space: nowrap;
overflow-x: hidden;
overflow-y: hidden;
}
The plugin's components should appear between the two buttons (left/right).
But, it does not work for me!
<tamplete>element need to be renamed to<template>? It is difficult to help with your issue unless you include the complete code.