Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

open modal js

$('#modal-name').modal('show');
Comment

modal javascript example

<button class="trigger">Click here to trigger the modal!</button>
<div class="modal">
    <div class="modal-content">
        <span class="close-button">&times;</span>
        <h1>Hello, I am a modal!</h1>
    </div>
</div>
Comment

modal javascript

const modalGallery = (id) => {
    let modal = $('#modal-gallery-before-after');
    let popup = modal.querySelector('.popup');
    let compare__item = $(`.compare__item-${id}`);
    let popupWrap = modal.querySelector(".popup__wrap");
    let popupItems = modal.querySelector(".popup__item");
    let modal_gallery_item = $(".modal-gallery-item");
    let item__image = compare__item.querySelector('.modal-image').innerHTML;
    let item__title = compare__item.querySelector('.modal-title').innerHTML;
    let modalItem = `<div id="modal__item-${id}" class="modal__item">
    <div class="modal__image">${item__image}</div>
    <div class="modal__title">${item__title}</div>
    </div>`;
    popupItems.setAttribute('data-popup', `${id}`);
    modal_gallery_item.innerHTML = modalItem;
    popup.style.display = "block !important";
    $(`.popup__item[data-popup="${id}"]`).classList.add("show_data");
    popupWrap.classList = `popup__wrap popup__wrap--${id}`;
    setTimeout(() => {
        popup.classList.add("show_data");
    }, 10);
}

const closeModal = () => {
   let modal = $('#modal-gallery-before-after');
   let popup = modal.querySelector('.popup');
   let popupWrap = modal.querySelector(".popup__wrap");
   popup.classList.remove("show_data");
   setTimeout(() => {
    popup.style.display = "";
    popupWrap.classList = `popup__wrap`;
}, 500);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript text word wrap replace 
Javascript :: how to display api data in html 
Javascript :: js check if array 
Javascript :: dockerfile copy ignore node_modules 
Javascript :: compare two dates using moment 
Javascript :: iframe chrome console 
Javascript :: jquery checkbox unchecked 
Javascript :: javascript hashtag url 
Javascript :: react open pdf in new tab 
Javascript :: javascript sql 
Javascript :: reactjs make main div scrollable 
Javascript :: how to add css in js 
Javascript :: sort object by key value javascript 
Javascript :: react forwardref 
Javascript :: how to capitalize first letter javascript 
Javascript :: javascript constructor function vs factory function 
Javascript :: check if input has value javascript 
Javascript :: remove all symbols javascript 
Javascript :: wait for ajax to finish 
Javascript :: javascript getminutes 2 digits 
Javascript :: mongoose validate on update 
Javascript :: search in string array javascript 
Javascript :: remove node_modules folder mac 
Javascript :: promise in forloop 
Javascript :: createrouter vue 3 history remove Hash 
Javascript :: hit click function only once on first click jquery 
Javascript :: how to access key of object in javascript 
Javascript :: difference between two dates in js 
Javascript :: nodejs array buffer to buffer 
Javascript :: js math.random 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =