Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jscrollpane block scrolling parent

Can i make jscrollpne such that parent pane doesnot scroll even when child scroll has reached its bottom. Now when child scrolling reaches bottom scrolling of parent occurs. I want parent to scroll only when mouse is out of child scrollpane.

like image 713
sabithpocker Avatar asked May 06 '10 09:05

sabithpocker


2 Answers

The behaviour you describe is by design. This is how the native browser scrollbars behave on an element which has overflow: auto. I wouldn't recommend changing it. However, if you wish to then Borgenk's answer is correct, you can use this code:

$('.scroll-pane')
    .jScrollPane()
    .bind(
        'mousewheel',
        function(e)
        {
            e.preventDefault();
        }
    );

See an example here (you may need to shrink your window so the parent has any need to scroll): http://jsfiddle.net/VYcDZ/51/

like image 192
vitch Avatar answered Oct 02 '22 17:10

vitch


You could use event.preventDefault()

$('.selector').mousewheel(function(event) {
    event.preventDefault();
});
like image 40
Borgenk Avatar answered Oct 02 '22 17:10

Borgenk