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.:
HTML:
<style>img{ display:none;} </style>
<img src="img1.jpg" class="other">
<img src="img2.jpg" class="iphone android">
<img src="img3.jpg" class="iphone">
<img src="img4.jpg" class="android">
<img src="img5.jpg" class="iphone android other">
CSS 1 (for devices different than iphone / android)
.other{ display:inline;}
CSS 2 (for iphones)
.iphone{ display:inline;}
CSS 3 (for androids)
.android{ display:inline;}
All I need now is to detect the device somehow ( I belive it can be done by jQuery and implement the correct CSS stylesheet).
So the effect will be:
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
how can I get the browser to select the proper stylesheet? I know how to do it by resolution, but I know for the operating systems it works different and can be done in jquery. It would be perfect if I can do it in a section, so I can use styles on the whole page. Thank you for your time and help.