Implemented text direction switch
Update index.php, text-direction-switch.js, and text_alignment.php
This commit is contained in:
16
htdocs/js/text-direction-switch.js
Normal file
16
htdocs/js/text-direction-switch.js
Normal 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';
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user