- This topic has 7 replies, 2 voices, and was last updated 7 years, 1 month ago by
Tom.
-
AuthorPosts
-
May 3, 2015 at 10:01 am #105085
Jack Heape
Could I please get the code so that I can have a “click to call” button on the mobile site? Thanks
May 3, 2015 at 10:06 am #105086Tom
Lead DeveloperLead DeveloperFor 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 ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 3, 2015 at 10:14 am #105087Jack Heape
Great thanks!
May 3, 2015 at 10:26 am #105093Tom
Lead DeveloperLead DeveloperYou’re welcome! ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 19, 2015 at 8:06 am #108885Jack Heape
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?
ThanksMay 19, 2015 at 8:51 am #108900Tom
Lead DeveloperLead DeveloperIt doesn’t look like you added the CSS provided here: http://generatepress.com/forums/topic/click-to-call-button-code-for-mobile-site/#post-105086
As for the button, you can adjust the colors with CSS as well:
/* Initial button state - replace #whatever with your desired color */ .button, .button:visited { background: #whatever; color: #whatever; } /* Button color on hover */ .button:hover { background: #whatever; color: #whatever; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 19, 2015 at 9:43 am #108915Jack Heape
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.May 19, 2015 at 3:01 pm #109005Tom
Lead DeveloperLead DeveloperLooks like you added your custom CSS to the parent stylesheet.
Instead, use a child theme or a custom CSS plugin: http://generatepress.com/knowledgebase/adding-css/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.