[Support request] Show button in Generateblocks time-controlled

Home Forums Support [Support request] Show button in Generateblocks time-controlled

Home Forums Support Show button in Generateblocks time-controlled

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1381083
    Frank Noack

    Hello GeneratePress Team,

    Is there a possibility to fade in a button in Generateblocks time-controlled, e.g. after 10 seconds?

    Thank you very much for an answer

    Frank

    #1381178
    David
    Staff
    Customer Support

    Hi there,

    it is possible with Javascript.
    Add this JS to the wp_footer hook:

    <script>
    window.onload = function() {
        document.getElementById('fade-in-button').className = 'active';
    };
    </script>

    And add this CSS to the site:

    #fade-in-button {
        opacity: 0;
        transition: opacity 0.2s ease-in;
        transition-delay: opacity 5s;
    }
    #fade-in-button.active {
        opacity: 1;
    }

    Then give your button an ID of fade-in-button

    The only problem is if a user has JS disabled in their browser the button may never appear.
    There is ways around that but it would involve the button being visible to begin with.

    #1381297
    Frank Noack

    Many Thanks David

    #1381472
    David
    Staff
    Customer Support

    You’re welcome

    #2324335
    Heinrich

    Hi David,

    can we use this code to fade in a container too?
    and what changes need to be done?

    Thanks in advance.

    #2324489
    David
    Staff
    Customer Support

    Hi Heinrich,

    yes you can use the same code as above, it doesn’t matter if it is a button or any block.
    But if you want you can change the ID being used to anything you want.
    For example we change the fade-in-button to fade-in-block:

    1. The script:

    <script>
    window.onload = function() {
        document.getElementById('fade-in-block').className = 'active';
    };
    </script>

    2. The CSS:

    #fade-in-block {
        opacity: 0;
        transition: opacity 0.2s ease-in;
        transition-delay: opacity 5s;
    }
    #fade-in-block.active {
        opacity: 1;
    }

    3. The ID you add to your block is: fade-in-block

    #2324513
    Heinrich

    hi david, thought so too, but do not get it to run. the element is visible immediate and don`t fade in.

    #2324529
    David
    Staff
    Customer Support

    If you want to raise a new topic where you can share a link to your site and where i can see the issue, ill take a quick look.

    #2324546
    Heinrich

    perfect, coming in a minute

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