Last active
May 9, 2018 16:02
-
-
Save navidkashani/eb17979eed8159bd7e5f to your computer and use it in GitHub Desktop.
Check Page Direction and Return Object() for some related data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get Value(Sample) : dirCheck().start => 'left' | |
function dirCheck(dir) { | |
dir = dir || document.getElementsByTagName("HTML")[0].getAttribute("dir"); | |
if (dir === 'rtl') { | |
return { | |
dir : 'rtl', | |
rtl : true, | |
ltr : false, | |
start : 'right', | |
end : 'left' | |
}; | |
} else { | |
return { | |
dir : 'ltr', | |
rtl : false, | |
ltr : true, | |
start : 'left', | |
end : 'right' | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment