很多时候我们会用到这样的样式
html,body{
height:100%;
overflow:hidden;
}
如果要用到js的话我们可以这样写:
document.documentElement.style.overflow = "hidden";
document.body.style.overflow = "hidden";
是的,只要用 document.documentElement
就可以获取HTML
这个标签啦。顺便再列一下其他的几种获取方法。
- document.getElementsByTagName(“html”)[0];
- document.querySelector(“html”);
- document.body.parentNode;
- $(‘html’).outerHTML()
写帖记录。