4

at the moment i have the following css

html{
overflow : hidden;
}

how can i change overflow to 'scroll' with javascript?

2 Answers 2

14

With jQuery:

$('html').css({overflow: 'scroll'});

Simple JavaScript

document.getElementsByTagName('html')[0].style.overflow = "scroll";

I hope this helps.

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

2 Comments

That would be jQuery, not Javascript.
jQuery is JavaScript :)
3

For one thing set the body not html

To change it to scroll do this:

document.body.style.overflow = "scroll";

1 Comment

@user521180 -- then what did you ask?

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.