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

RTL Support proposal (Issue #156) #196

Closed

Conversation

aurovrata
Copy link
Contributor

@aurovrata aurovrata commented Sep 1, 2021

Proposal for enabling RTL functionality, issue #156

The plugin uses a flexbox to display the slide track. In RTL direction, the flex-direction automatically reverses.

It's therefore a simple matter (I reckon :) of reversing the element scrollLeft directive to ensure the slides display/scroll from right to left.

I have introduced a new option setting,

_.opt.dir = 1 | -1

which by default is 1 and is set to -1 for a rtl element.

Each _.ele.scrollLeft directive is then multiplied with the new setting, i.e.

_.ele.scrollLeft * _.opt.dir 

this ensures that calculations of slider status remained unchanged, while the scrollTo function has its scroll value also multiplied by the new setting to ensure the scrollLeft directive goes in the correct direction,

_.ele.scrollLeft = _.opt.dir * scrollTarget

aurovrata and others added 6 commits September 20, 2020 22:16
add a slide index data attribute to each slide upon initialisation.

line 103,
[].forEach.call(_.slides, function (_) {
      _.classList.add('glider-slide')
})

changed to 

 [].forEach.call(_.slides, function (_,i) {
      _.classList.add('glider-slide');
      _.setAttribute('data-gslide',i)
    })
slide index attribute
@aurovrata aurovrata mentioned this pull request Sep 1, 2021
@aurovrata aurovrata closed this Sep 2, 2021
@aurovrata aurovrata deleted the NickPiscitelli-master branch September 2, 2021 12:18
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

Successfully merging this pull request may close these issues.

1 participant