Created
January 18, 2017 14:48
-
-
Save sokoljr/033ae73964a71c9ccf15dcf682297c1a to your computer and use it in GitHub Desktop.
Modal with JSON
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
/*Modal*/ | |
$("#slick_slider div.top_slider_image").click( function(event) { | |
event.preventDefault(); | |
$('#overlay').fadeIn(400, | |
function() { | |
$('#modal_form') | |
.css('display', 'block') | |
.animate({opacity: 1}, 200); | |
}); | |
var id_pattern = /id([0-9]+)/; | |
var game_id = id_pattern.exec( $(this).attr( 'class' ) ); | |
var modal_id = seen( parseInt(game_id[1]), modals, 'id' ); | |
var active_modal = modals[ modal_id ]; | |
$( '#modal_form .modal_body' ).html( active_modal.content ); | |
}); | |
$('#modal_close, #overlay').click( function() { | |
$('#modal_form') | |
.animate({opacity: 0}, 200, | |
function() { | |
$(this).css('display', 'none'); | |
$('#overlay').fadeOut(400); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment