The problem of listening for scroll events in two boxes respectively


    leftEle.addEventListener("scroll", (e) =>{
         rightEle.scrollTop= e.target.scrollTop
    })
                
    rightEle.addEventListener("scroll", (e)=> {
        leftEle.scrollTop= e.target.scrollTop
    })
    

causes the mouse scroll to slide very slowly, so the scrollTop on both sides should contain each other"s scrolling at the same time. Is there any way to use both scrolls to isolate synchronization without restraining

Apr.14,2022

roughly understand what you mean. Do you want to scroll on the left and follow on the right? When you scroll on the right, do you follow the left? And then try not to influence each other?


wrote a demo , js code as follows:


var timeout = null;
window.addEventListener('scroll', function() {
    if(timeout !== null) clearTimeout(timeout);
    timeout = setTimeout(function() {
        var scrollTop = this.scrollY;
        console.log(scrollTop);
    }.bind(this), 500);
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36962-2c020.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36962-2c020.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?