Site logo

[Resolved] Page Fade

Home Forums Support [Resolved] Page Fade

Home Forums Support Page Fade

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2258584
    David

    Hello,

    I came across this on the support posts which is great…
    https://generatepress.com/forums/topic/fade-in-on-page-load/

    And I have used the code

    body {
        opacity: 1;
        transition: 1s opacity;
    }
    body.fade-out {
        opacity: 0;
        transition: none;
    }
    document.body.className += ' fade-out';
    
    jQuery(function() {
            jQuery('body').removeClass('fade-out');
        });

    It is working here…
    http://shalayogahaven-co-uk.stackstaging.com/

    How do I get it to only fade the page content and not the header – I’ve tried changing body to main on both the css and jquery, but no luck.

    Thanks
    Dave

    #2258736
    David
    Staff
    Customer Support

    Hi there,

    so the jQuery can remain as is. And you can adapt the CSS to target an element inside the body

    body .site {
        opacity: 1;
        transition: 1s opacity;
    }
    body.fade-out .site {
        opacity: 0;
        transition: none;
    }
    #2258739
    David

    Perfect – thanks David

    #2258796
    David
    Staff
    Customer Support

    You’re welcome

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.