简体   繁体   English

同时使用TEL和EMAILTO

[英]Using TEL and EMAILTO at the same time

So im dealing with a minor issue on a website im coding, i made it so any image is clickable and will activate a phone number to call to as im dealing with bookings (restaurants, spa, services, when clicked it triggers the phone app on any mobile device and Skype on PC. 因此,即时通讯正在处理网站即时编码上的一个小问题,我这样做是为了使任何图片均可点击,并会激活一个电话号码以致电即时通讯来处理预订(餐厅,水疗中心,服务,当单击它会触发电话应用任何移动设备和PC上的Skype。

As not everyone has a Skype account (with credit), how could i implement the emailto tag when the website is used on a desktop on the same images that already have the tel tag? 由于不是每个人都有一个Skype帐户(具有信用),当网站在桌面上使用已经带有tel标签的相同图像时,如何实现emailto标签?

Here's a quick solution using jQuery and isMobile , along with a data attribute to hold the phone number. 这是使用jQuery和isMobile的快速解决方案,以及用于保存电话号码的data属性。

 $(document).ready(function() { // Determine if we're using a mobile device if (isMobile.any) { // Loop through each link with the data-tel attribute $('[data-tel]').each(function() { $(this) // Update the link's href to use the telephone number .prop('href', 'tel:' + $(this).data('tel')) .text('Tel link (mobile detected)'); }); } }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ismobilejs/0.4.1/isMobile.js"></script> <a href="mailto:test@aol.com" data-tel="555-1234-567"> Email link (desktop detected) </a> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM