Viewing 1 replies (of 1 total)
  • Plugin Author NorikDavtian

    (@norikdavtian)

    You can write a small JavaScript to handle the conversion of phone numbers into clickable telephone links.

    Here is a snippet:
    If you want to validate for smartphones only then write a function to evaluate value of isMobile to true if it’s a phone. You can use screen size or a third party library like DeviceJS https://github.com/matthewhudson/device.js

    Then var isMobile = device.mobile();

    or var isMobile = ($(document).width() <= 640);

    // convert tel links to phone number for mobile devices
    if (isMobile) {
        var $tel = $('.bigContact-phone .bigContact-value');
        if($tel.length){
            $tel.each(function(index) {
                $('<a id="' + $($tel[index]).attr('id') + '" class="' + $($tel[index]).attr('class') + '" href="tel:' + $($tel[index]).text().replace(/\D/g, '') + '">' + $($tel[index]).text() + '</a>').insertBefore($($tel[index]));
                $($tel[index]).remove();
            });
        }
    }

    Don’t forget to test it.. Just wrote this as an starting point for you.

Viewing 1 replies (of 1 total)
  • The topic ‘Making Phone Numbers Mobil accessible’ is closed to new replies.