I have 2 divs that both uses iScroll. Now I would like both divs to scroll when one of them are scrolled.
I want them to scroll simultaneously
Is this possible?
I have 2 divs that both uses iScroll. Now I would like both divs to scroll when one of them are scrolled.
I want them to scroll simultaneously
Is this possible?
Try structuring the div
as follows :
<div id=wrapper>
<div id="scroller">
<div id="div1">
<div id="child1"></div>
</div>
<div id="div2">
<div id="child2"></div>
</div>
</div>
</div>
Then define iscroll for #wrapper
and you get to scroll both the div simultaneously. This is the easy way.
Or you can try to get the onScroll event
. Though it is not possible to exactly get on scroll position during scroll but you can still get is in on onScrollMove
and onScrollEnd
. Hope this helps you.
You can use
scrollTo
method to scroll the second div at a specified position on scrolling any div. It takes three arugments out of which timeout is optional.scrollTo(x, y, timeout)
- scrolls to any x,y location inside the scrolling area.