glide
glide copied to clipboard
direction: 'rtl' not working when type is 'carousel'
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.
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.
@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 🚀