Question

I want to use iScroll 4 in a Right-to-Left website.
I defined to my list items:

direction: rtl
float: right

Also, at the beginning I call the function scrollToElement so the page opens the first item.

The problem that remains for me is that when the page scrolls to a particular item - it is scrolling so that its left edge aligned to the left edge of the page, and what I need is - its right edge to be aligned to the right edge of the page.

Is it possible to get it?

JSFiddle demo

Was it helpful?

Solution

One of my colleagues found the answer.

In the iScroll js file, you should replace this line:

pos.left = pos.left > 0 ? 0 : pos.left < that.maxScrollX ? that.maxScrollX : pos.left;

with:

pos.left = pos.left - el.clientWidth + that.wrapperW;

.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top