Skip to content

Instantly share code, notes, and snippets.

@saljam saljam/rtl.html
Last active Sep 23, 2015

Embed
What would you like to do?
Include this script in your Go present slides to make them right-to-left
<script>
document.addEventListener('DOMContentLoaded', function(){
// Code is generally left-to-right, so we set all <pre> tags with dir=lrt explicitly.
var pres = document.getElementsByTagName("pre");
for (var i = 0; i < pres.length; i++) {
pres[i].dir="ltr";
}
// Everything else is right-to-left.
document.getElementsByTagName("body")[0].dir="rtl";
// Add CSS rules to override the slide change animation direction
var style = document.createElement("style");
style.setAttribute("media", "screen");
document.head.appendChild(style);
style.sheet.insertRule(".slides > article.far-past{transform: translate(2040px) !important}");
style.sheet.insertRule(".slides > article.past{transform: translate(1020px) !important}");
style.sheet.insertRule(".slides > article.next{transform: translate(-1020px) !important}");
style.sheet.insertRule(".slides > article.far-next{transform: translate(-2040px) !important}");
style.sheet.insertRule(".slides.layout-widescreen > article.far-past, .slides.layout-faux-widescreen > article.far-past{transform: translate(2260px) !important}");
style.sheet.insertRule(".slides.layout-widescreen > article.past, .slides.layout-faux-widescreen > article.past{transform: translate(1130px) !important}");
style.sheet.insertRule(".slides.layout-widescreen > article.next, .slides.layout-faux-widescreen > article.next{transform: translate(-1130px) !important}");
style.sheet.insertRule(".slides.layout-widescreen > article.far-next, .slides.layout-faux-widescreen > article.far-next{transform: translate(-2260px) !important}");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.