Jump to content

LostAndFurious

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by LostAndFurious

  1. Hi,

    I'm trying to build a loading navigation animation on my 7.1 website. 

    A simple up/down curtain that opens on click and closes after the new page has loaded. But the first part of the animation seems to make the next page load twice (it doesn't happen on reloads). 

    Is there a way to avoid it ? I've been looking everywhere and haven't figured out a way to do it on 7.1

    My site is not open yet but here are the scripts I have :

    In Header :

    <div id="fullscreen-loader" class="fullscreen-loader"></div>

    In Footer :

    <script>
    document.addEventListener('DOMContentLoaded', function() {
        var loader = document.getElementById('fullscreen-loader');
    
        // Immediately hide the loader if it's showing when the page loads.
        loader.style.animation = 'collapse 1s forwards';
        loader.addEventListener('animationend', function() {
            loader.style.display = 'none';
        }, { once: true });
    
        // Function to handle navigation after the exit animation
        function navigateAfterAnimation(href) {
            loader.style.display = 'block'; // Make sure the loader is visible
            loader.style.animation = 'none'; // Reset any previous animation
            void loader.offsetWidth; // Trigger reflow
            loader.style.animation = 'expand 0.5s forwards'; // Start the exit animation
    
            loader.addEventListener('animationend', function() {
                window.location = href; // Navigate after the animation completes
            }, { once: true });
        }
    
        // Attach this navigation logic to all links on the page
        document.querySelectorAll('a').forEach(link => {
            link.addEventListener('click', function(e) {
                e.preventDefault(); // Prevent the default link behavior
                const href = this.getAttribute('href');
                navigateAfterAnimation(href);
            });
        });
    });
    
    </script>

    And CSS :

    /*LOADING SCREENS*/
    .fullscreen-loader {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%; /* Start fully expanded for the entering animation */
      background-color: black;
      z-index: 9999; /* High z-index to ensure it covers other content */
      display: block; /* Initially visible */
    }
    
    /* Collapse animation for entering */
    @keyframes collapse {
      0% {
        top: 0;
        height: 100%;
      }
      100% {
        top: 100%;
        height: 0%;
      }
    }
    
    /* Expand animation for exiting */
    @keyframes expand {
      0% {
        top: 100%;
        height: 0%;
      }
      100% {
        top: 0;
        height: 100%;
      }
    }

    Does anyone has an idea of what may be causing the issue ? Is there a fix or is it just not achievable with 7.1 ?

    Thanks in advance!

    L&F

  2. 8 hours ago, tuanphan said:

    Add to Design > Custom CSS. Adjust number 50 for spacing

    @media screen and (max-width:767px) {
    	.gallery-masonry-wrapper.gallery-masonry-list--ready {
        height: auto !important;
        display: grid;
        grid-template-columns: repeat(1,1fr) !important;
        grid-column-gap: 10px;
        grid-row-gap: 10px;
    }
    figure.gallery-masonry-item {
        position: relative !important;
        width: 100% !important;
        transform: unset !important;
        margin-bottom: 50px;
    }
    .gallery-masonry-item-wrapper {
        height: 100% !important;
    }
    }

     

    Wow ! Thank you so much ! It's absolutely perfect. Exactly what I was trying to do....

    Thanks a lot !

  3. 6 hours ago, tuanphan said:

    Can you share link to page where you use masonry? We can help easier

    Hi, 

    Sure : https://www.vladimirconsigny.com/nights-in-sicily here is one.

    The page actually contains a slideshow and a masonry. The slideshow only shows up on desktop and masonry on phone... (a workaround i found to display differently on different devices. Not sure that there wasn't a better solution though...? )

    Thank yo very much for taking the time...

     

  4. On 2/27/2022 at 12:35 PM, tuanphan said:

    Try this new code

    @media only screen and (max-width: 640px) {
        div#BlogMasonryContainer {
            columns: 2;
            column-gap: 0;
            height: auto!important;
            display: block!important;
            padding: 0px;
        }
        div#BlogMasonryContainer {
            height: auto!important;
        }
       .blog-masonry .masonry-ready .entry.is-loaded {
            position: relative!important;
            transform: none!important;
            width: 100%!important;
            display: block;
            padding: 1.5px!important;
            box-sizing: border-box;
        }
    
        .blog-masonry .masonry-ready .entry.is-loaded img {
            height: 100%!important;
          	width: 100%!important;
        object-fit: contain !important;
        }
    }

     

    Hi,

    I’m looking for a way to increase the space between each pictures in a 1 column masonry gallery on mobile. While keeping them full size… Do you think you could help ?

    i ve looked everywhere and can’t seem to find the solution…

     

    thanks a lot in advance !

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.