Skip to content

Commit

Permalink
More RTL Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Nov 28, 2015
1 parent a972707 commit 4539715
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,6 @@ s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;

var translate = - s.snapGrid[s.snapIndex];

// Stop autoplay
if (s.params.autoplay && s.autoplaying) {
if (internal || !s.params.autoplayDisableOnInteraction) {
Expand Down Expand Up @@ -1746,7 +1745,7 @@ s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
s.updateAutoHeight();
}

if (translate === s.translate) {
if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {
s.updateClasses();
if (s.params.effect !== 'slide') {
s.setWrapperTranslate(translate);
Expand Down
7 changes: 5 additions & 2 deletions src/js/parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
function setParallaxTransform(el, progress) {
el = $(el);
var p, pX, pY;
var rtlFactor = s.rtl ? -1 : 1;

p = el.attr('data-swiper-parallax') || '0';
pX = el.attr('data-swiper-parallax-x');
Expand All @@ -22,18 +23,20 @@ function setParallaxTransform(el, progress) {
pX = '0';
}
}

if ((pX).indexOf('%') >= 0) {
pX = parseInt(pX, 10) * progress + '%';
pX = parseInt(pX, 10) * progress * rtlFactor + '%';
}
else {
pX = pX * progress + 'px' ;
pX = pX * progress * rtlFactor + 'px' ;
}
if ((pY).indexOf('%') >= 0) {
pY = parseInt(pY, 10) * progress + '%';
}
else {
pY = pY * progress + 'px' ;
}

el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
}
s.parallax = {
Expand Down

0 comments on commit 4539715

Please sign in to comment.