athulraj k p
athulraj k p

Reputation: 11

Remove the scrollbar in internet explorer

I have a layout page which I use in every pages. Among these Cshtml pages, I need to remove scroll bar from some. I gave a code, which is working fine in google chrome, but failing in internet explorer. Can any one help me? Thanks in advance.My code is below

document.getElementsByTagName('body')[0].style = 'overflow: hidden';

Upvotes: 1

Views: 87

Answers (2)

Sanguinary
Sanguinary

Reputation: 354

Microsoft has their own property for their browsers. Use this CSS property:

-ms-overflow-style: none;

Read more about it here.

Upvotes: 1

Lonnie Best
Lonnie Best

Reputation: 11354

Maybe it is the html element that is producing the scrollbar in IE. Try this:

document.getElementsByTagName('body')[0].style = 'overflow: hidden';
document.getElementsByTagName('html')[0].style = 'overflow: hidden';

I usually handle this with CSS like this:

html
{
    height: 100%;
    margin: 0;
    padding: 0;
    overflow:hidden;
}
body
{
    height: 100%;
    margin: 0;
    overflow:hidden;
}

Upvotes: 1

Related Questions