Last active
October 22, 2019 16:26
-
-
Save beatrizsmerino/905ad7674855c99c6a9930e6430f0e88 to your computer and use it in GitHub Desktop.
Pop up inside the html to position it above all
This file contains 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).ready(function () { | |
// open popup | |
$(".popup__button-open").on("click", function () { | |
var $this = $(this), | |
$thisPopUp = $this.closest(".swiper-slide").find('.popup'); | |
$thisPopUp.clone().appendTo(".global-locations").addClass("is-view"); | |
// close popup | |
var timer = setInterval(function () { | |
if ($(".popup.is-view .popup__button-close").length > 0) { | |
clearInterval(timer); | |
$(".popup.is-view .popup__button-close, .popup.is-view").on("click", function (e) { | |
var $this = $(this), | |
$thisPopUp = $this.closest(".popup"); | |
$thisPopUp.remove(); | |
}); | |
// close popup when click outside except when click inside of box | |
$('.popup.is-view .popup__inner').click(function (event) { | |
event.stopPropagation(); | |
}); | |
} | |
}, 100); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment