Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling child div scrolls the window, how do I stop that?

I have a div, with a scroll bar, When it reaches the end, my page starts scrolling. Is there anyway I can stop this behavior ?

like image 942
Jeevan Avatar asked Apr 18 '12 14:04

Jeevan


People also ask

How do I stop Div scrolling?

Disabling scroll with only CSS. There's another way to disable scrolling that is commonly used when opening modals or scrollable floating elements. And it is simply by adding the CSS property overflow: hidden; on the element you want to prevent the scroll.

How do I stop my screen from scrolling in HTML?

you can do: position: fixed; on the element you don't want to be scrollable.


1 Answers

You can inactivate the scrolling of the whole page by doing something like this:

<div onmouseover="document.body.style.overflow='hidden';" onmouseout="document.body.style.overflow='auto';"></div> 
like image 141
Teemu Avatar answered Oct 13 '22 20:10

Teemu