Created
September 25, 2012 22:21
-
-
Save ianoxley/3784818 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
:-webkit-full-screen .gist { | |
overflow-y:auto; | |
} |
This file contains hidden or 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
// 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); |
This file contains hidden or 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
// 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