baguetteBox.js icon indicating copy to clipboard operation
baguetteBox.js copied to clipboard

can't support rtl language !

Open ho3ein-y opened this issue 6 years ago • 2 comments

please update code for RTL language's. thanks

ho3ein-y avatar Jun 26 '18 22:06 ho3ein-y

i'm ready for RTL language modify the baguetteBox.js: add RTL proprty to option 👍 // Global options and their defaults

var options = {},
      defaults = {
          RTL:false,
          captions: true,
          buttons: 'auto',
          fullScreen: false,
          noScrollbars: false,
          bodyClass: 'baguetteBox-open',
          titleTag: false,
          async: false,
          preload: 2,
          animation: 'slideIn',
          afterShow: null,
          afterHide: null,
          onChange: null,
          overlayBackgroundColor: 'rgba(0,0,0,.8)'
      };

and change line in updateOffset() function 💯 from : offset = -currentIndex * 100 + '%'; to :

       var offset;
       if (options.RTL)
           offset = currentIndex * 100 + '%';
       else
           offset = -currentIndex * 100 + '%';
       /*initial gallery with RTL option*/
       baguetteBox.run('.galleryBox', {RTL:true});

and enjoy 🥇

PERSIAN GULF

ho3ein-y avatar Jun 26 '18 22:06 ho3ein-y

On version 1.11.1 I solved it by adding a little minus: Before: var e = 100 * -u + '%'; After: var e = -100 * -u + '%';

ghost avatar Oct 19 '20 15:10 ghost