Created
December 19, 2012 19:49
-
-
Save henriquegogo/4339881 to your computer and use it in GitHub Desktop.
Extreme simple modal using jQuery
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
$(document).on("click", ".modal", function() { | |
$(".modal-view").remove(); | |
var imageSrc = $(this).attr("href"); | |
var image = $("<img>").attr("src", imageSrc).attr("style", "box-shadow: 0 0 40px #000"); | |
var modal = $("<div class='modal-view'>").attr("style","position: fixed; padding-top: 50px; top: 0; bottom: 0; left: 0; right: 0; z-index: 10; text-align: center; background: rgba(0, 0, 0, 0.5);"); | |
modal.html(image) | |
.appendTo("body"); | |
return false; | |
}).on("click", ".modal-view", function() { | |
$(this).remove(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment