Skip to content

Instantly share code, notes, and snippets.

@hzoo
Created February 25, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hzoo/b20f604ddf44917ea0e7 to your computer and use it in GitHub Desktop.
Save hzoo/b20f604ddf44917ea0e7 to your computer and use it in GitHub Desktop.
Bookmarklet to toggleRTL (also adds rtl class to body)
(function() {
var body = $("body");
var dir = body.css("direction");
if (dir === "") {
body.css("direction", "rtl");
body.toggleClass('rtl');
} else if (dir === "ltr") {
body.css("direction", "rtl");
} else {
body.css("direction", "ltr");
}
body.toggleClass('rtl');
})();
javascript:!function(){var t=$("body"),s=t.css("direction");""===s?(t.css("direction","rtl"),t.toggleClass("rtl")):"ltr"===s?t.css("direction","rtl"):t.css("direction","ltr"),t.toggleClass("rtl")}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment