Lock and unlock page scroll with jQuery
Scroll the page before opening the demo, then check the restored position when you close it.
Try page scroll locking
Open the modal, scroll its content, then close it. The background page is locked while the modal is open and restored afterward.
Use Close and unlock inside the modal or press Escape to return to the article.
Loading. JavaScript, jQuery, and native dialog support are required.
Background page section 1
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 2
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 3
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 4
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 5
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 6
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 7
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.
Background page section 8
This extra content makes the document scrollable. Open the modal from the top, scroll inside its panel, and close with the button or Escape. The document should return to its original position.
The demo keeps its logic local, uses the bundled jQuery file, and changes only the properties it records for restoration.