Hide scrollbar in IE

馋奶兔 提交于 2019-11-29 22:54:46

In case of anyone still needs a solution, this one worked for me:

.container{
    -ms-overflow-style: none;
    overflow: auto;
}

This change allows scroll on the container and hides the bars on IE.

Tested on IE 10 && 11.

Reference

Hard to say without seeing the code! Saying that, You could try use using the "Extended Attributes" that Microsoft introduced for Internet Explorer.

<body scroll="no">

EDIT:

You could also try setting the overflow property of the html page in CSS like so.

html, body { overflow: hidden; }

This CSS works for me both in Chrome and IE 10:

/* Oculta la scroll-bar pero sigue permitiendo hacer scroll con el mouse */
    body::-webkit-scrollbar { display: none;  }
    html, body { -ms-overflow-style: none; overflow: auto; }

You may use this code implement it into body --

body { overflow-x:hidden; }

If not by that look into the layout and see if any container have a untoward width of something which is making the layout stretch a bit...

curt

Make sure IE is not in compatibility mode before you beat yourself up while trying overflow:hidden;

I cannot provide plain CSS solution, but if you use jQuery, it is easy to set the computed width and height to the body this way:

$("body").css({"width": body.width()+"px", "height": body.height()+"px"})

and then

$("body").css({"overflow": "hidden"});

worked also in IE (at least in IE9+). My goal was to make page not scrollable temporarily (when custom dialog with own scrolling capability was shown). And when custom dialog was closed, I reset the body style attribute to its previous state (to remove the computed body width and height).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!