Hide scrollbar in IE

前端 未结 7 1479
猫巷女王i
猫巷女王i 2020-12-24 05:24

In our application for UI we are using JSF or Prime faces for that. We would like to hide the scrollbar for our application, but we are struggling to achieve this in Interne

7条回答
  •  余生分开走
    2020-12-24 06:01

    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).

提交回复
热议问题