Howdy, im following an older forum post on creating a modal with custom code. Everything works fine except when I added the snippet to close the modal window by clicking on the body
, it now immediately closes the modal when you click to open it
I didn’t see anyone else having this issue in the thread. Any idea what’s going on here? I’m a .js rookie.
The code:
$(document).ready(function() {
$('.modal-link-1').click(function() {
$('.modal-container-1').fadeIn();
});
$('.close-modal').click(function() {
$('.modal-container-1').fadeOut();
});
$('body').click(function() {
$('.modal-container-1').fadeOut();
});
});
Here is my site Read-Only: https://www.mindsetux.com/home-v2
https://preview.webflow.com/preview/portfolio-v2-9fc31b?utm_medium=preview_link&utm_source=designer&utm_content=portfolio-v2-9fc31b&preview=8c6a6b896fb7d3e80e4f96c168f803f0&pageId=5fde8f2bb0fc7023cf45c12e&mode=preview