Derek
Derek

Reputation: 12378

Stop end of scroll triggering another scroll?

I have two divs in this sample code. If you scroll down and past the end of the blue div, the overall body/div also scrolls down. Is there a way to prevent the other scrolling effect even if I'm past a scroll boundary on the blue div?

i.e. when the blue div scrolls and reaches a boundary, nothing else should scroll.

sample: http://jsfiddle.net/nXN9H/

css solution prefered, but a simple js/jquery solution would be suffice.

Upvotes: 2

Views: 96

Answers (1)

Sachin
Sachin

Reputation: 40970

I think you want something like this

body
{
    overflow:hidden;
}

JS Fiddle 1

You can also try this

<div onmouseover="document.body.style.overflow='hidden';" onmouseout="document.body.style.overflow='auto';" >

JS Fiddle 2

Upvotes: 2

Related Questions