modal in css code example

Example 1: modal pop up html css


    

Example 2: modal pop up html css

var modal = document.querySelector(".modal");
    var trigger = document.querySelector(".trigger");
    var closeButton = document.querySelector(".close-button");

    function toggleModal() {
        modal.classList.toggle("show-modal");
    }

    function windowOnClick(event) {
        if (event.target === modal) {
            toggleModal();
        }
    }

    trigger.addEventListener("click", toggleModal);
    closeButton.addEventListener("click", toggleModal);
    window.addEventListener("click", windowOnClick);

Example 3: how to make popup modal in jquery with example


Example 4: how to make popup modal in jquery with example

$("#sticky").modal({
  escapeClose: false,
  clickClose: false,
  showClose: false
});

Tags:

Misc Example