From aa8baaabf5ff8fff293099feff32616e3a4f87c3 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 4 Dec 2013 15:08:32 +0000 Subject: [PATCH] Twenty Fourteen: RTL for the slider. props yoavf. see #25801. git-svn-id: https://develop.svn.wordpress.org/trunk@26606 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyfourteen/js/slider.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wp-content/themes/twentyfourteen/js/slider.js b/src/wp-content/themes/twentyfourteen/js/slider.js index e06ae25223..34463322e4 100644 --- a/src/wp-content/themes/twentyfourteen/js/slider.js +++ b/src/wp-content/themes/twentyfourteen/js/slider.js @@ -37,6 +37,7 @@ slider.container = $( slider.containerSelector, slider ); slider.count = slider.slides.length; slider.prop = 'marginLeft'; + slider.isRtl = $( 'body' ).hasClass( 'rtl' ); slider.args = {}; // TOUCH slider.transitions = ( function() { @@ -445,6 +446,12 @@ slider.getTarget = function( dir ) { slider.direction = dir; + + // Swap for RTL. + if ( slider.isRtl ) { + dir = 'next' === dir ? 'prev' : 'next'; + } + if ( dir === 'next' ) { return ( slider.currentSlide === slider.last ) ? 0 : slider.currentSlide + 1; } else {