ccc

  • 85
Featured Channels
  •  · 51 followers
  •  · 60 followers
  •  · 79 followers
Posts
Discussions
Added a post  to  , ccc
Go StudioPages -> PostsSelect "View Post" pageAdd new "raw block"Add the code below and name it "JS Modal"Set Block Layout to "Content" Save<style> .ImgThumbnail { border-radius: 5px; cursor: pointer; transition: 0.3s; } .ImgThumbnail:nth-of-type(1) { margin-left: 20%; } .modal { display: none; position: fixed; z-index: 1; padding-top: 100px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0.9); } .modalImage { margin: auto; display: block; width: 50%; height: 60%; max-width: 700px; } { margin: auto; display: block; width: 80%; max-width: 700px; text-align: center; color: ; padding: 10px 0; height: 150px; } .close { position: absolute; top: 15px; right: 35px; color: ; font-size: 40px; font-weight: bold; transition: 0.3s; } .close:hover, .close:focus { color: rgb(255, 0, 0); cursor: pointer; } @media only screen and (max-width: 700px) { .modalImage { width: 100%; } } .fr-fic.fr-dib{cursor:pointer;} </style> <!-- The Modal --> <div class="modal"> <span class="close">×</span> <img class="modalImage" id="img01" /> </div> <script> $(document).ready(function () { var modalEle = document.querySelector(".modal"); var modalImage = document.querySelector(".modalImage"); Array.from(document.querySelectorAll(".fr-fic")).forEach(item => { item.addEventListener("click", event => { modalEle.style.display = "block"; modalImage.src = event.target.src; }); }); document.querySelector(".close").addEventListener("click", () => { modalEle.style.display = "none"; }); }); </script>That's it
  • 1060

UNA - Social Media Software Framework

Close