Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stopPropagation in scroll()-Method won't stop outer div from scrolling

I have a inner dev with a fixed height and overflow-y: scroll; where the contents can be scrolled in y direction. When the scrolling hits the top or the bottom the outer div is scrolled. I want to prevent that.

<section id="concept" class="testimonials bg-black">
   <div class="col-lg-12">
      <div class="concept-frame">
      </div>
   </div>
</section>

I use following JavaScript:

$( ".concept-frame" ).scroll( function(e) {
    console.log( "Scolling ..."+$(this).scrollTop() );

    e.stopPropagation();
} );

But with no effect. How can I stop that the scrolling is propagated to the outer div?

like image 820
Michael Avatar asked Nov 11 '16 09:11

Michael


1 Answers

the scroll event doesn't bubble so e.stopPropagation(); will not work

to prevent the scroll of the parent see:

Prevent scrolling of parent element?

like image 120
madalinivascu Avatar answered Oct 08 '22 03:10

madalinivascu