Can you please tell me if it is possible to execute the function while the hover of the element is done without setInterval? That the function would be looped.
$("#left").hover(function() {
left_statuses();
})
function left_statuses() {
var scroll = $(".scroll").scrollLeft();
var new_scroll = scroll + 100;
$(".scroll").scrollLeft(new_scroll);
}
.left {
z-index: 1;
}
.scroll {
width: 100px;
height: 50px;
background: red;
overflow: hidden;
overflow-x: scroll;
}
.scroll div {
width: 1000px;
height: 50px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="left">
LEFT
</div>
<div class="scroll">
<div></div>
</div>