jQuery or Javascript - how to disable window scroll without overflow:hidden;

后端 未结 8 1899
耶瑟儿~
耶瑟儿~ 2020-12-01 01:16

Hi is it possible to disable window scrolling without using overflow:hidden; when i\'m hover an element?

i tryed :

$(\'.chat-content\').         


        
8条回答
  •  佛祖请我去吃肉
    2020-12-01 01:54

    Try to handler 'mousewheel' event on all nodes except one

    $('body').on({
        'mousewheel': function(e) {
            if (e.target.id == 'el') return;
            e.preventDefault();
            e.stopPropagation();
        }
    })
    

    Demo: http://jsfiddle.net/DHz77/1/

提交回复
热议问题