Skip to content

Instantly share code, notes, and snippets.

@rissole
Created March 5, 2015 22:38
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 rissole/d4493908f1b70e1ac065 to your computer and use it in GitHub Desktop.
Save rissole/d4493908f1b70e1ac065 to your computer and use it in GitHub Desktop.
they call them hackathons for a reason
$('div.feed-item').click(function() {
var url = $(this).attr('data-url');
var $veil = $('<div style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 99; background-color: rgba(0,0,0,0.5);">');
var $frame = $('<iframe style="position: absolute; background-color: #fff; box-shadow: 0 0 3em #333; z-index: 100;">');
$frame.attr('src', url);
var $body = $('body');
var w = $body.width() * 0.8;
var h = $body.height() * 0.8;
$frame.css('width', w);
$frame.css('height', h);
$frame.css('top', $body.height() * 0.1);
$frame.css('left', $body.width() * 0.1);
$body.append($veil);
$body.append($frame);
var removeFrame = function(e) {
if (e.keyCode === 27) {
$veil.remove();
$frame.remove();
}
}
$(document).keyup(removeFrame);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment