CSS-NibblePoker/htdocs/js/text-direction-switch.js
Herwin efd18af9b7 Implemented text direction switch
Update index.php, text-direction-switch.js, and text_alignment.php
2024-11-16 17:11:47 +01:00

17 lines
608 B
JavaScript

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';
}
});
};
});
});