Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Project as pop-up

Project as pop-up

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 93 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JohannesHaech
    wrote on Mar 28, 2024, 1:13 PM last edited by JohannesHaech Mar 28, 2024, 9:13 AM
    #1

    Hi everyone,

    I'm currently working on designing a one-pager using Laytheme, and I'm looking to implement a specific functionality. I want users to be able to click on an image and have a popup window open (similar to a lightbox). Ideally, I'd like to create a page or project that appears as a popup overlaying the main page when clicked.

    I've attempted to illustrate what I'm aiming for in a small sketch.![240312 udch3.0 02md.png](Image dimensions are too big)
    Has anyone here attempted something similar or knows of a straightforward solution or additional plugin to achieve this within Laytheme? Any guidance or recommendations would be greatly appreciated!

    Thanks in advance for your help!240312 udch3.0 02md.png

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arminunruh
      Global Moderator
      wrote on Mar 29, 2024, 10:49 AM last edited by
      #2

      hey its not really possible i think!

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JohannesHaech
        wrote on Apr 2, 2024, 8:16 AM last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • J Offline
          J Offline
          JohannesHaech
          wrote on Apr 2, 2024, 10:06 AM last edited by
          #4

          Okay, with some GPT assistance and my limited knowledge, I've found a workaround. It's working quite okay for now. The problem is that the carousel plugin doesn't load directly but only after clicking on it. Perhaps someone can come up with a solution within my makeshift workaround to fix that.

          I have solved it using a custom HTML element and some CSS and JavaScript. Here is the webpage where I am testing it and the individual code blocks.

          testpage

          html:

          <div class="project-thumbnail" onclick="toggleOverlay('overlayID', true)">
            <img src="http://johannes-haeffner.de/wp-content/uploads/2024/03/ARU-bilder-2594-1.jpg" alt="Projekt Thumbnail">
          </div>
          
          <div id="overlayID" class="overlay" style="display:none;">
            <iframe src="http://johannes-haeffner.de/popup-test-loading-page/" frameborder="0"></iframe>
          </div>
          
          

          css

          
          .overlay {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 40%;
            height: 40%;
            background-color: white;
            z-index: 1000;
            overflow-y: auto;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
          }
          
          .overlay iframe {
            width: 100%;
            height: 100%;
          }
          
          body.blur-background {
            overflow: hidden;
          }
          
          
          .overlay button {
            position: absolute;
            top: -30px;
            right: 0;
            z-index: 1001;
          }
          
          
          body.id-930 a.sitetitle {
              display: none;
          }
          
          
          body.id-930 a.overlay-burger {
              display: none;
          }
          
          

          java

          <script>
            document.addEventListener('DOMContentLoaded', function () {
             
              function toggleOverlay(show) {
                var overlay = document.getElementById('overlayID');
                if (show) {
                  overlay.style.display = 'block';
                  document.body.classList.add('blur-background');
                } else {
                  overlay.style.display = 'none';
                  document.body.classList.remove('blur-background');
                }
              }
          
             
              document.querySelector('.project-thumbnail').addEventListener('click', function(e) {
                e.stopPropagation(); // Verhindert das Auslösen des document click Event Listeners
                toggleOverlay(true);
              });
          
             
              document.addEventListener('click', function(e) {
                var overlay = document.getElementById('overlayID');
                if (overlay.style.display === 'block' && !overlay.contains(e.target)) {
                  toggleOverlay(false);
                }
              });
          
           
              document.getElementById('overlayID').addEventListener('click', function(e) {
                e.stopPropagation();
              });
            });
          </script>
          1 Reply Last reply
          0
          • A Offline
            A Offline
            arminunruh
            Global Moderator
            wrote on Apr 2, 2024, 7:55 PM last edited by arminunruh Apr 2, 2024, 3:57 PM
            #5

            Screenshot 2024-04-02 at 16.51.54.png

            it shows this error in the console

            u can try the fade carousel instead of the swipe carousel
            and then in the js that opens the popup include:

            if (typeof window.layCarouselFadeCarousel != 'undefined' && typeof window.layCarouselFadeCarousel.loadFirstLazyImage != 'undefined') {
            window.layCarouselFadeCarousel.loadFirstLazyImage(jQuery(this))
            }
            

            the jQuery(this) here needs to target the container the carousel is a child of. So you'd change that to jQuery(overlay)

            put that code after

            if (show) 
            

            in the toggleOverlay function

            function toggleOverlay(show) {
            

            or try disabling lazyloading for carousel images in lay options → carousel addon

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JohannesHaech
              wrote on Apr 3, 2024, 9:24 AM last edited by
              #6

              The deactivation of lazy loading has solved the problem. Thank you very much.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes

              3/6

              Apr 2, 2024, 8:16 AM


              I also code custom websites or custom Lay features.
              💿 Email me here: 💿
              info@laytheme.com

              Before you post:
              1. When using a WordPress Cache plugin, disable it or clear your cache.
              2. Update Lay Theme and all Lay Theme Addons
              3. Disable all Plugins
              4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

              This often solves issues you might run into

              When you post:
              1. Post a link to where the problem is
              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
              Online Users
              C
              craigfeldspar
              4 minutes ago
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Login

              • Don't have an account? Register

              • Login or register to search.
              3 out of 6
              • First post
                3/6
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Search