Reputation: 2507
I have a page that listens for the Home and End keys, and then when when I put jScrollPane on my window, it now scrolls as well, and I don't want that. How can I stop the window scrolling when hitting Home or End? return false;
doesn't work.
Thanks in advance.
Upvotes: 1
Views: 196
Reputation: 140210
Make sure you attach the listener before jScrollPane does:
$(elem).on( "keydown", function(e){
if( e.which === 35 || e.which === 36 ) {
e.stopImmediatePropagation();
}
}).jScrollPane( ... )
Upvotes: 1