[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4821
  • Last Modified:

How to I stop webpage scrolling via Javascript?

I've created an Interstitial Ad in Javascript that uses CSS layers to display an external web page, enclosed around a border.  But the problem I am having; is that if the underlying webpage is longer / taller than a the browser window; when scrolling the layered external website; and reaching the end it will start scrolling the underlying web page; thus pushing the layered web page away...

How can I prevent the underlying webpage from scrolling?  

This is all done in Javascript by the way, with an included JS file.

  • 2
1 Solution
could you show an example?

you can hide the scrollbars on the containing element (eg. div) by setting overflow:hidden;

which can be set in javascript as

document.getElementByID('myDiv').style.overflow = 'hidden';
adworldmediaCTOAuthor Commented:
Unfortunately I don't have any examples that are "safe for work"...

Basically I think all I need is something to prevent scrolling on a webpage itself.  I've done it before i just can't remember :)
adworldmediaCTOAuthor Commented:
I found the solution in a third party script:



Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now