From cedced140ec66ba4d77461f3445f1c497c8f67a3 Mon Sep 17 00:00:00 2001 From: ido Kobelkowsky Date: Tue, 26 Apr 2022 14:06:49 +0300 Subject: [PATCH] simple support for rtl adding support by detecting the dir attribute on the html tag, which is usually set on RTL websites. --- src/baguetteBox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/baguetteBox.js b/src/baguetteBox.js index 71c642a8..64990d87 100644 --- a/src/baguetteBox.js +++ b/src/baguetteBox.js @@ -677,7 +677,7 @@ } function updateOffset() { - var offset = -currentIndex * 100 + '%'; + var offset = -currentIndex * ( document.getElementsByTagName('html')[0].getAttribute('dir') == 'rtl' ? -100 : 100 ) + '%'; if (options.animation === 'fadeIn') { slider.style.opacity = 0; setTimeout(function() {