i building html5 apps both android , iphone using phonegap , jquery mobile.
is possible apply different style sheets ios , android.
how can include style sheets after detecting particular os.
the following javascript code:
var devicetype = (navigator.useragent.match(/ipad/i)) == "ipad" ? "ipad" : (navigator.useragent.match(/iphone/i)) == "iphone" ? "iphone" : (navigator.useragent.match(/android/i)) == "android" ? "android" : (navigator.useragent.match(/blackberry/i)) == "blackberry" ? "blackberry" : "null";
using have, can add found devicetype class body tag.
javascript
var devicetype = (navigator.useragent.match(/ipad/i)) == "ipad" ? "ipad" : (navigator.useragent.match(/iphone/i)) == "iphone" ? "iphone" : (navigator.useragent.match(/android/i)) == "android" ? "android" : (navigator.useragent.match(/blackberry/i)) == "blackberry" ? "blackberry" : "null"; $("body").addclass(devicetype); css
the code below example styling div read different devices.
div { /* general style div */ } .iphone div { /* style div in iphone (will override general style) */ } .android div { /* style div in android (will override general style) */ }
Comments
Post a Comment