Skip to content

Instantly share code, notes, and snippets.

@saljam
Last active September 23, 2015 17:27
Show Gist options
  • Save saljam/a97beee492aab6b66483 to your computer and use it in GitHub Desktop.
Save saljam/a97beee492aab6b66483 to your computer and use it in GitHub Desktop.
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