Last active
June 14, 2019 09:48
-
-
Save k-ish/ad611357bc65b00c7db363424de3b75f to your computer and use it in GitHub Desktop.
スマホの電話リンク
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="tel_link">090-5555-6666</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// スマホの電話リンク | |
var ua = navigator.userAgent; | |
if(ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0){ | |
$('.tel_link').each(function(){ | |
var str = $(this).text(); | |
$(this).html($('<a>').attr('href', 'tel:' + str.replace(/-/g, '')).append(str + '</a>')); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment