Implemented text direction switch

Update index.php, text-direction-switch.js, and text_alignment.php
This commit is contained in:
Herwin
2024-11-16 17:11:47 +01:00
parent a2a229c720
commit efd18af9b7
3 changed files with 24 additions and 6 deletions

View File

@@ -0,0 +1,16 @@
const eTextDirectionSwitches = document.querySelectorAll(".text-direction-switch");
const eTextDirectionTargets = document.querySelectorAll(".text-direction-target");
document.addEventListener("DOMContentLoaded", () => {
eTextDirectionSwitches.forEach(eSwitch => {
eSwitch.onclick = function() {
eTextDirectionTargets.forEach(eTarget => {
if(eTarget.style.direction === "rtl") {
eTarget.style.direction = 'ltr';
} else {
eTarget.style.direction = 'rtl';
}
});
};
});
});