sample1p
var sample1BtnRight = document.getElementById('sample1BtnRight'); var sample1BtnLeft = document.getElementById("sample1BtnLeft"); sample1BtnRight.onclick = function () { document.getElementById('sample1Div').scrollLeft += 100; }; sample1BtnLeft.onclick = function () { document.getElementById('sample1Div').scrollLeft -= 100; };
sample2p
function s2Func(){ document.getElementById('s2Div').scrollLeft += 10; setTimeout(function(){ s2Func() }, 100); } s2Div.addEventListener("click", s2Func);