glide icon indicating copy to clipboard operation
glide copied to clipboard

direction: 'rtl' not working when type is 'carousel'

Open jasperuitterhoeve opened this issue 5 years ago • 2 comments

When i want to use the glide showing as an coursel with the direction rtl instead of default it does not work.

Is their any solution to this?

Thanks and keep up the good work.

jasperuitterhoeve avatar Apr 15 '20 13:04 jasperuitterhoeve

I had similar problem with version 3.3.0 (that I was bundling with parcel and took it from files in github repo directly). Buth then I noticed that in releases there is version 3.4.1 and upgrade fixed it for me.

halas avatar May 08 '20 13:05 halas

@jasperuitterhoeve - The issue is that the direction isn't being set correctly when switching languages.

The fix is to detect RTL mode dynamically and apply the correct direction:

document.addEventListener("DOMContentLoaded", function () {
    const isRTL = document.documentElement.dir === 'rtl'; // Detect RTL
    new Glide('.glide', {
        type: 'carousel',
        direction: isRTL ? 'rtl' : 'ltr', // Fix RTL issue dynamically
    }).mount();
});

Tested and working 🚀

rizwanellahi avatar Jan 30 '25 07:01 rizwanellahi