Site logo

Archived topic

click to call button code for mobile site

7 replies · Started by Jack Heape on May 3, 2015

Viewing posts 1–8 of 8

Could I please get the code so that I can have a "click to call" button on the mobile site? Thanks

For sure!

First, add this CSS:

.show-on-mobile {
      display: none;
}

@media (max-width:768px) {
      .show-on-mobile {
            display: block;
      }
}

Then, add this HTML wherever you want the button to show up:

<div class="show-on-mobile">
      <a class="button" href="tel:123-456-7890">Call me!</a>
</div>

Of course, you'll have to adjust the phone number.

Hope this helps :)

Great thanks!

You're welcome! :)

No problem on putting the code on the css, and the html works fine and shows up. Problem is it also shows up on the pc browser as well. See http://divingservicecharleston.com
I need the "call me" button to only be on the mobile site, on the initial screen before any scrolling is required. Anyway to code that? and also make the button a better color, like green or red?
Thanks

I added this at the end of the current css file after the click to call button code.

/* Initial button state - replace #whatever with your desired color */
.button,
.button:visited {
background: #04B404;
color: #000000;
}

/* Button color on hover */
.button:hover {
background: #04B404;
color: #000000;
}
It did not work.

This archived topic is closed to new replies.