Ciao a tutti, ho un problema con scrollLeft di jQuery che non funziona questi sono i miei code:
codice HTML:
<style>
.scroll-orizontal>div {
position: relative;
width: 100%;
overflow: hidden
scroll-behavior: smooth;
}</style>
<div class="scroll-orizontal">
<a href="#" class="btnScrollLeft"></a>
<a href="#" class="btnScrollRight"></a>
<div class="cnt-scroll">
<ul>
...
</ul>
</div>
codice:
$(document).ready(function() {
const elScroll = $(".cnt-scroll");
$("body").on("click", ".btnScrollRight", function(e) {
e.preventDefault();
elScroll.scrollLeft(500);
e.stopImmediatePropagation();
});
});