dynamic hide scrollbar before print code example

Example 1: javascript hide scrollbar

// You can hide the document scrollbar with this...
document.body.style.overflow = 'hidden';
//...and unhide it with this:
document.body.style.overflow = 'visible';

// Or switch between them:
booleanCondition
  ? document.body.style.overflow = 'hidden'
  : document.body.style.overflow = 'visible';

Example 2: how to remove scrollbars using javscript

body {
  overflow-y: hidden; /* Hide vertical scrollbar */
  overflow-x: hidden; /* Hide horizontal scrollbar */
}

Tags:

Css Example