Created
January 25, 2020 00:06
-
-
Save Olein-jp/c67993f81f3709154e7f9770525decf4 to your computer and use it in GitHub Desktop.
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
<div id="modal-id" class="modal modal-open"> | |
<button class="modal-close">X</button> | |
</div> |
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-open').each( function(){ | |
$(this).on( 'click', function(){ | |
var target = $(this).data( 'target' ); | |
var modal = document.getElementByID( target ); | |
$(modal).fadeIn(); | |
// if you'd like to change diplay property to 'inline-block' or 'flex', write below | |
// $(modal).fadeIn().css( 'display', 'flex' ); | |
return false; | |
}); | |
}); | |
$('.modal-close').on( 'click', function(){ | |
$('.modal').fadeOut(); | |
}); |
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
<a href="#" data-target="modal-01"> | |
<!-- Open modal if you click this aea --> | |
</a> | |
<a href="#" data-target="modal-02"> | |
<!-- Open modal if you click this aea --> | |
</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment