因此,我在一个网站im编码上处理一个小问题,我制作的任何图像都是可点击的,并将激活一个电话号码,以便调用as im处理预订(餐馆、水疗、服务,点击时会触发手机应用程序在任何移动设备上,Skype在PC上)。
由于不是每个人都有Skype帐户(有信用),当网站在桌面上使用时,我如何实现电子邮件标签?
发布于 2017-11-29 22:54:42
这里有一个使用jQuery和isMobile的快速解决方案,还有一个数据属性来保存电话号码。
$(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>
https://stackoverflow.com/questions/47563083
复制相似问题