I am trying to synchronize two scrollable DIVS scroll positions.
Methods used:
Method 1 : The scroll event sets the scrollTop of another DIV. problem: the scroll event executed at the end and the user interface is sluggish in iOS safari.
Method 2 : Use setInterval to synchronize both scroll positions. Problem: iOS does not perform timer functions during scrolling, so the scroll positions are synchronized at the end. Again, this is more sluggish. Trying to fix the timers, as mentioned in many blogs, but still without grace.
Method -3 : I tried the custom scrollbar, so iScroll tried to synchronize as with the scroll event Problem: this seems better, but on iOS it is still sluggish !!!
Method -4 : I tried a custom scrollbar, so iScroll tried to synchronize as with the scroll event Problem: iScroll is used, but using timers, depending on the onScroll event, But during touchmove iOS is busy providing animations rather fulfilling the required timers before touching. The code below refers to this method. It is also sluggish.
var active = .., other = ... // active : active Scrolling element // other : Element to be in sync with active window.setInterval(function () { var y; if (active) { y = active.y; } else { return; } var percentage = -y / (active.scrollerHeight - active.wrapperHeight); var oscrollTop = percentage * (other.scrollerHeight - other.wrapperHeight); if (-other.maxScrollY >= toInt(oscrollTop)) { other.scrollTo(0, -toInt(oscrollTop)); } }, 20);
How can I synchronize scroll positions with two scrollable DIVS anti-aliasing. Please offer me something, it annoys me.
source share