I\'m trying to make a page where some elements will be visible only for android and iphone. I was thinking of using simple css properties to hide the elements e.g.:
You can do it by javascript
like:
As per these points
img1: displayed only on devices other than iphone and android
img2: displayed only on iphone and android devices
img3: displayed only on iphones
img4: displayed only on android devices
img5: displayed only on all devices
CSS
.show{display:block;}
.hide{display:none;}
HTML
SCRIPT
var IS_IPHONE = navigator.userAgent.match(/iPhone/i) != null;
var IS_ANDROID = navigator.userAgent.match(/Android/i) != null;
if(IS_IPHONE)
{
$('#image3, #image2').removeClass('hide').addClass('show');
}
else if(IS_ANDROID)
{
$('#image4, #image2').removeClass('hide').addClass('show');
}
else
{
$('#image1').removeClass('hide').addClass('show');
}
$('#image5').removeClass('hide').addClass('show');