LePierre
LePierre

Reputation: 1

Control CSS with javascript

I currently have some fixed position items on my mobile screen. Now I would like to have a js. routine, which, when running at the startup of the app, determines the version of the operating system (ios4 or ios5). Depending on the system detected, it would choose a css tag such as "margin" and assign it a specific value like "-60" or "0".

How would such a js. script look like?

Thanks

Pierre

Upvotes: 0

Views: 866

Answers (1)

alfrodo
alfrodo

Reputation: 159

you could use something like this to detect the ios version and change the margin

if(navigator.userAgent.indexOf('iOS 4') != -1){ 
    document.getElementById('target').style.margin = "-60px"
}

Upvotes: 1

Related Questions