0

I'm trying to set a CSS property, that is specific to IE, via javascript. Something like the following

document.body.style.-ms-content-zooming = "zoom";

or

document.body.style.-ms-scroll-snap-x = "whatever"

But the css property doesn't get set the way shown above (I tried the first line for sure). How could I accomplish the above task, or setting any css starting with a dash (-) for that matter, using javascript?

1 Answer 1

4

I do not have an Internet Explorer at hand but usually styles containing dashes are camelcased like:

document.body.style.msContentZooming = "zoom";

See this MSDN Blog post

Sign up to request clarification or add additional context in comments.

3 Comments

great .. This actually worked ..! will accept the answer in 6min.
cool, was'nt sure if MS did it the same way, but I've found a reference that confirms this first hand.
FYI: the reason for this is that JavaScript treats the - character as a subtract operation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.