if not “my operating system” change css - jquery

感情迁移 提交于 2019-12-12 03:44:29

问题


I'm trying to make a 'css hack' that will allow me to change css depending on a user's OS.

For Mac and iOS I want one style, for everything else (Windows, Linux, Android, etc...) I want a different style.

So far I've cobbled together this:

if (navigator.platform = :not("MacIntel")) {
        $("p").css("font-size", "50px");
    } 

But, I'm not sure how to take it further.

What I want to do is say: if not Mac or iOS, then change the css font size element.

Any idea how i can do this?

I've made a jsFiddle here:

  • http://jsfiddle.net/b9r5G/

As I've said above, I've got it half working... I need help getting it to 100%.

Thanks!


回答1:


Saw something here:How to detect mobile browser using jQuery or in some other SIMPLE way..?

var android = (navigator.platform.indexOf("android")>=0); //true if android


来源:https://stackoverflow.com/questions/15421788/if-not-my-operating-system-change-css-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!