Skip to content

Instantly share code, notes, and snippets.

@ianoxley
Created September 25, 2012 22:21
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 ianoxley/3784818 to your computer and use it in GitHub Desktop.
Save ianoxley/3784818 to your computer and use it in GitHub Desktop.
:-webkit-full-screen .gist {
overflow-y:auto;
}
// include.js
// ----------
// Code for included the full screen code snippets on your site
var s = document.createElement('script');
s.src = 'https://raw.github.com/gist/3784818/c69646def2328f589aeb632615cdca099ec80c62/snippets.js';
document.getElementsByTagName('head')[0].appendChild(s);
// full screen code snippets
(function() {
"use strict";
function addCss() {
var css = 'html:-webkit-full-screen .gist, html:fullscreen { height: 100%; overflow:auto; width: 100%; }';
var styleTag = document.createElement('style');
styleTag.innerHTML = css;
document.getElementsByTagName('head')[0].appendChild(styleTag);
}
function fullScreenerise(gist) {
// addCss();
gist.addEventListener('click', function() {
if (gist.requestFullScreen) {
gist.requestFullScreen();
} else if (gist.mozRequestFullScreen) {
gist.mozRequestFullScreen();
} else if (gist.webkitRequestFullScreen) {
gist.webkitRequestFullScreen();
}
}, true);
}
if (document.querySelectorAll) {
var gists = document.querySelectorAll('.gist');
for (var i = 0, length = gists.length; i < length; i++) {
fullScreenerise(gists[i]);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment