Working Ninja
2014-11-03T17:55:25
jQuery and CSS Synergy

There are times that you want to hide mobile specific features on desktop to avoid user confusion. Today I ran into such a case where a tel href on a phone number was being used that resulted in someone getting a 404. To hide this from desktop, I used jQuery to reference the display value to only load if the value was set to block.

var $isMobile = $(‘.toy-gallery td’).css(‘display’);

if ( $isMobile == ‘block’ ) {
    $(‘.phone-number’).wrapInner(‘<a href=”tel:5555555555″></a>’);
}