Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // Click close to close modal
  2. $(".product-modal__close").click(function(){
  3. $(".product-modal__container").removeClass("active");
  4. $(".product-modal__content").empty();
  5. $("body").css("overflow", "visible")
  6. })
  7.  
  8. // Click anywhere but the modal and trigger close modal
  9. $(".product-modal__container").click( function() {
  10. $(this).removeClass("active");
  11. $(".product-modal__content").empty();
  12. $("body").css("overflow", "visible")
  13. });
  14. $(".product-modal__content").click( function(e) {
  15. e.stopPropagation();
  16. });
  17.  
  18. // Escape Close Modal
  19. $(document).on('keyup',function(evt) {
  20. if (evt.keyCode == 27) {
  21. $(".product-modal__container").removeClass("active");
  22. $(".product-modal__content").empty();
  23. $("body").css("overflow", "visible")
  24. }
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement