Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is right to left supported? #345

Open
mostafakazemi opened this issue Aug 23, 2020 · 3 comments
Open

is right to left supported? #345

mostafakazemi opened this issue Aug 23, 2020 · 3 comments

Comments

@mostafakazemi
Copy link

mostafakazemi commented Aug 23, 2020

i have a right to left layout and it is in Persian (a RTL language). I need a new option for VueScrollTo. something like an option called reverseDirection: true. is it ok to submit a pr for that?

@rigor789
Copy link
Owner

@mostafakazemi what's different when it comes to scrolling with RTL languages? The scrolling is done from current place to the target - no matter where it is on the page, it should still scroll to it whether it's above, below, left or right - unless I'm missing something here?

@mostafakazemi
Copy link
Author

Scroll start from right in RTL pages. When click an element, set scrollLeft value, but we should set scrollRight

@rigor789
Copy link
Owner

@mostafakazemi Ok I see - but there is no scrollRight. The calculations look to be fine for rtl, except that we are scrolling to the right edge of the element. To get around that, you can scroll programmatically and set a negative offset equal to the width of the element.

scrollToElement() {
  const el = document.querySelector('#element')
  this.$scrollTo(el, {
    x: true,
    container: '#container',
    offset: -el.clientWidth
  })
}

See https://jsfiddle.net/zL9wua5g/3/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants