Site logo

[Resolved] Floating Contact Button after Page-Hero

Home Forums Support [Resolved] Floating Contact Button after Page-Hero

Home Forums Support Floating Contact Button after Page-Hero

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1495359
    Benny

    Hey there, i wanted to know if its possible to show a floating (fixed) Call-to-Action Button after the Page-Hero. This is my website –> https://fragbenny.de/

    Thank you in advance!

    #1495458
    David
    Staff
    Customer Support

    Hi there,

    you can use a Block Element with the generate_after_header hook:

    https://docs.generatepress.com/article/block-element-overview/

    #1495752
    Benny

    Hey David, thanks for your answer. I’ve made a new block with the hook above but it isn’t working as expected. I think i have to change it from position: fixed to sticky?
    Here is the relevant CSS for the Button:

    width: 70px;
    height: 70px;
    background-color: #fbb13c;
    border-radius: 50%;
    text-align: center;
    display: flex;
    position: fixed;
    right: 2%;
    bottom: 3%;
    transition: all 0.1s ease-in-out;

    At the end the button should be appear after the page-hero and it should be fixed to the bottom right.

    Thanks for your help!

    #1495845
    Leo
    Staff
    Customer Support

    Is the button added currently?

    I’m not seeing anything after the page hero.

    #1495892
    Benny

    It is. At the right bottom there is a fixed orange button.

    #1496010
    Leo
    Staff
    Customer Support

    So what is the issue currently?

    I can see the button at the bottom right of the page hero and it seems work quite good?

    #1496017
    Benny

    I wanted it to be over the content area and footer but not hovering over the page-hero.

    #1496091
    Leo
    Staff
    Customer Support

    So basically you want it to appear after the user starts to scroll down the page?

    I’m not aware of a method to do that without a custom solution unfortunately.

    #1496100
    Benny

    Yes, exactly. Maybe if the button is in the content area and with position:sticky?

    #1496121
    Leo
    Staff
    Customer Support

    That case you can try the generate_inside_container hook and see if you can make it work with position: sticky:
    https://docs.generatepress.com/article/hooks-visual-guide/

    #1496124
    Benny

    I’ve tried it with z-index: -1; but then it’s half under the content area but not shown under the page-hero (which would be perfect without the other problem).

    #1496152
    Leo
    Staff
    Customer Support

    Actually just try this CSS with your current layout:

    .page-hero {
        position: relative;
        z-index: 1;
    }
    #1496155
    Benny

    Leo, i’ve tried this already but it wasnt working. I stuck next under the page-hero and moved a bit but not as expected.

    #1496172
    Benny

    Will try!

    Thanks Leo

    #1496537
    Benny

    Works perfect Leo. This is what i was looking for!

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