Use documentElement to correctly get the size of the current visible area

  • 2020-03-30 03:35:42
  • OfStack

None of the other methods work, and only this documentElement can correctly get the size of the current visible area


var w = parseInt(document.documentElement.clientWidth);
var h = parseInt(document.documentElement.clientHeight);

Related articles: