Created
March 5, 2015 22:38
-
-
Save rissole/d4493908f1b70e1ac065 to your computer and use it in GitHub Desktop.
they call them hackathons for a reason
This file contains 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
$('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