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

有帮助吗?

解决方案

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;

.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top