Skip to content

Instantly share code, notes, and snippets.

@wakim
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save wakim/e317171ff80e7945a63e to your computer and use it in GitHub Desktop.

Select an option

Save wakim/e317171ff80e7945a63e to your computer and use it in GitHub Desktop.
Simple Refill Modal
$(function(){
$(".modal-inner").on("click", function(e) {
e.stopPropagation();
});
$(".modal-fade-screen, .modal-close, .modal").on("click", function() {
var thisModalId = this.getAttribute("for");
Modal.close(thisModalId);
});
});
window.Modal = {};
window.Modal.close = function(modalId) {
$("body").removeClass("modal-open");
$("#" + modalId).prop("checked", false).change();
}
window.Modal.open = function(modalStateId) {
var $modalState = $("#" + modalStateId);
$("body").addClass("modal-open");
$modalState.prop("checked", true).change();
$("body").addClass("modal-open");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment