Jump to content

Want to hide sticky button on desktop and only show on mobile

Recommended Posts

Posted (edited)

Site URL: https://www.accorddental.ca/dental-office-near-me

I am having issues with adding a CTA sticky floating button that is on my landing page.  I would only like it to show up on my mobile page and not the desktop page.  How do I accomplish that and where do I insert code(and what code?). 

How I got to where I am:
In the advance part of the page in question I inserted the following code:

<div id="customFloatingButton">
    <a href="tel:12234533" target="_blank">Call Now</a>
</div>

<style>
    #customFloatingButton {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }
    #customFloatingButton a {
        display: inline-block;
        background-color: #2952a3;
        color: white;
        padding: 15px 30px;
        text-decoration: none;
        box-shadow: 0px 5px 10px -5px rgba(0,0,0,0.5);
        transition: 200ms;
    }
    #customFloatingButton a:hover {
        transform: scale(1.04);
    }
</style>

How can I just make it just show up on the mobile only?
Thanks

Edited by AlexJR
rephrased
  • AlexJR changed the title to Want to hide sticky button on desktop and only show on mobile
  • Replies 1
  • Views 395
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted
11 hours ago, AlexJR said:

Site URL: https://www.accorddental.ca/dental-office-near-me

I am having issues with adding a CTA sticky floating button that is on my landing page.  I would only like it to show up on my mobile page and not the desktop page.  How do I accomplish that and where do I insert code(and what code?). 

How I got to where I am:
In the advance part of the page in question I inserted the following code:

<div id="customFloatingButton">
    <a href="tel:12234533" target="_blank">Call Now</a>
</div>

<style>
    #customFloatingButton {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }
    #customFloatingButton a {
        display: inline-block;
        background-color: #2952a3;
        color: white;
        padding: 15px 30px;
        text-decoration: none;
        box-shadow: 0px 5px 10px -5px rgba(0,0,0,0.5);
        transition: 200ms;
    }
    #customFloatingButton a:hover {
        transform: scale(1.04);
    }
</style>

How can I just make it just show up on the mobile only?
Thanks

Add these code on Custom CSS panel in Website Utilities Website Tools > Custom CSS.

@media (min-width: 768px) {
    #customFloatingButton {
        display: none !important;
    }
}

 

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

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.