0

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

1
  • you could do element.setAttribute("style", "background-color:blue"); Commented Oct 20, 2011 at 22:38

1 Answer 1

1

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"
}
Sign up to request clarification or add additional context in comments.

1 Comment

You need to make that "-60px" so that all browsers can handle it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.