Skip to content

Commit

Permalink
feat(core): better RTL support in CSS Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Aug 6, 2021
1 parent 43d8396 commit 3503ced
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 1 addition & 5 deletions src/core/events/onScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ export default function onScroll() {
if (!enabled) return;
swiper.previousTranslate = swiper.translate;
if (swiper.isHorizontal()) {
if (rtlTranslate) {
swiper.translate = wrapperEl.scrollWidth - wrapperEl.offsetWidth - wrapperEl.scrollLeft;
} else {
swiper.translate = -wrapperEl.scrollLeft;
}
swiper.translate = -wrapperEl.scrollLeft;
} else {
swiper.translate = -wrapperEl.scrollTop;
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/slide/slideTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ export default function slideTo(
}
if (params.cssMode) {
const isH = swiper.isHorizontal();
let t = -translate;
if (rtl) {
t = wrapperEl.scrollWidth - wrapperEl.offsetWidth - t;
}
const t = rtl ? translate : -translate;
if (speed === 0) {
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
if (isVirtual) {
Expand Down

0 comments on commit 3503ced

Please sign in to comment.