alejomejia
2/1/2018 - 12:38 PM

Wrap phone and WhatsApp number on mobile into a CTA

Transform phone and WhatsApp numbers into a CTA on mobile devices.

<span class="custom-phone">+57 4 584 1141</span>
<span class="custom-wsp">+57 311 648 6027</span>
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
 jQuery('span.custom-phone').wrap('<a class="xt-anchor" href="tel:+5745841141"></a>');
 jQuery('span.custom-wsp').wrap('<a class="xt-anchor" href="https://api.whatsapp.com/send?phone=573116486027&text=¡Hola!%20Me%20interesan%20sus%20productos"></a>');
}