Jump to content

[Share] Floating button

Recommended Posts

Posted

To add a floating button, you can follow these steps.

#1. First, you can edit Site Footer

image.png.ff656ffc36ae24311e6597731ac37057.png

and add a Button Block with desired url.

image.png.9207db236fe475c2fd270c0f5b7461c4.png

#2. Find Button Block ID.

In my example, it is: #block-yui_3_17_2_1_1732112517625_15057

image.png.9b5e435eb7d410301d90f9c85c6a1e2e.png

#3. Use this code to Custom CSS box

#block-yui_3_17_2_1_1732112517625_15057 {
     position: fixed;
    bottom: 10px;
    right: 10px;
    display: block !important;
    z-index: 99999;
    width: 250px;
    height: 50px;
}
body:not(.sqs-edit-mode-active) {
footer.sections section, footer.sections {
z-index: 99999 !important;
}}

image.png.1a96afe20e0264eef930ba5bb7f687a2.png

Result:

Button will float & sticky on bottom right corner when users scroll.

image.png.0273b53dbb32437d84747fbc67403c86.png

#4. To make it float on bottom left corner, you can change

right: 10px;

to

left: 10px;

image.thumb.png.81ce125e96d2c323f4a2ca6b12e81bff.png

#5. To make float button appears on Mobile only, use this extra CSS code

#block-yui_3_17_2_1_1732112517625_15057 {
    display: none !important;
}
@media screen and (max-width:767px) {
    #block-yui_3_17_2_1_1732112517625_15057 {
        display: block !important;
    }
}

image.png.35995acb21aa08925c72393beaff4654.png

#6. If you want to add 2 Floating button, you can add 2 button blocks to Footer.

Then find ID.

Suppose we have IDs: #block-yui_3_17_2_1_1732112517625_15057 and #block-0fcba09aec50928a077b

image.png.42a9f2664fc66cdb27999d59ed5b30db.png

Next, use CSS code like this to Custom CSS box

#block-yui_3_17_2_1_1732112517625_15057, #block-0fcba09aec50928a077b {
    position: fixed;
    bottom: 10px;
    right: 10px;
    display: block !important;
    z-index: 99999;
    width: 250px;
    height: 50px;
}
#block-0fcba09aec50928a077b {
  bottom: 80px;
}
body:not(.sqs-edit-mode-active) {
footer.sections section, footer.sections {
    z-index: 99999 !important;
}}

image.thumb.png.62645ab1ca1e944ea8ba1a0914102634.png

Result

image.png.895fc6d3fbb8c09c3cc81eab9105e41c.png

#7. If you want to make Floating button float on bottom of mobile site, use this new CSS code

#block-yui_3_17_2_1_1732112517625_15057 {
& {
    position: fixed;
    bottom: 0;
   left: 0;
   right: 0;
    display: none;
    z-index: 99999;
    width: 100%;
    height: 50px;
}
  a {
    border-radius: 0 !important;
    background-color: #ece9e4 !important;
  }
@media screen and (max-width:767px) {
  & {
    display: block !important;
  }
  }}
body:not(.sqs-edit-mode-active) {
footer.sections section, footer.sections {
    z-index: 99999 !important;
}}

image.thumb.png.bcfab4acf74b33cd14f74a47102efbfe.png

Result

image.png.2ee16f8ee492a01586331abc3a49620c.png

#7.2. If 2 buttons, use code like this

#block-yui_3_17_2_1_1732112517625_15057, #block-0fcba09aec50928a077b {
& {
    position: fixed;
    bottom: 0;
   left: 0;
   right: 0;
    display: none;
    z-index: 99999;
    width: 50%;
    height: 50px;
}
  a {
    border-radius: 0 !important;
    background-color: #ece9e4 !important;
  }
@media screen and (max-width:767px) {
  & {
    display: block !important;
  }
  }}
#block-yui_3_17_2_1_1732112517625_15057 {
  right: 50%;
}
#block-0fcba09aec50928a077b {
  left: 50%;
}
body:not(.sqs-edit-mode-active) {
footer.sections section, footer.sections {
    z-index: 99999 !important;
}}

image.thumb.png.a5690b241facee74c8e9c7e083802bdb.png

Result

image.png.f13f703dd62ec027b6d733693d68960f.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • Replies 0
  • Views 71
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • 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.