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

后端 未结 8 1906
耶瑟儿~
耶瑟儿~ 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:39

    Without external variables:

           $('.element').bind('mousewheel', function(e, d) {
                if((this.scrollTop === (this.scrollHeight - this.offsetHeight) && d < 0)
                    || (this.scrollTop === 0 && d > 0)) {
                    e.preventDefault();
                }
            });
    

提交回复
热议问题