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
I have done another subject here another question, but there is one important tricky thing. After applying everything, I will later need to change only HTML, I won't be able to touch jquery and css files later, so as I will do them they must remain untouched. I will be able to manually add classes to each image only, so I only thing I can manipulate is manually adding and removing classes from the pure html. How can I do it? So, if I add class="iphone android", then the image will be displayed on these two systems. Also can I do it by iOX generally? So it will work on iphones, ipods, ipads, etc?. Thx for your help and time.
BTW. I know how to do it for different resolutions, but here I need specifically for the each operating systems, so if I have a button which leads the user to the android market, I need the specific button/image to be displayed only on Android devices... etc. Thanks