Jump to content

Contact button in header: Link to email on desktop and SMS on mobile

Recommended Posts

Posted

Site URL: https://www.lisawolffmcintyre.com/

Hi Squarespacers!

I enabled the button element in my header and named it "Contact." When someone is viewing mobile, I'd like them to be able to tap the button to call my client. But when someone clicks the button from desktopwell, the attached image expresses my feelings about this situation. Is there code I can deploy that would allow a user to call from mobile but email from desktop? Thanks so much!

Julia

2022-01-17_18-42-24.png

Posted

Add this code to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
	$('.header-display-desktop a.btn').attr('href','mailto:lisa@palermolistings.com');
});
</script>

 

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!)

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.