Web前端笔记-解决[Intervention] Unable to preventDefault inside passive event listener due to target being

x33g5p2x  于2022-06-10 转载在 其他  
字(0.8k)|赞(0)|评价(0)|浏览(338)

我这里是使用NiceScroll造成的。

报错如下:

解决这个问题的方法有2种:

Ⅰ:修改源码找到jquerynicesroll.js

报错的地方:直接让其return false

Ⅱ:修改自己的代码逻辑:

构造这样的结构:

<body class="d-flex h-100 w-100 flex-column">

@include('layouts._header')

<div id="mainDiv" class="container-fluid">
    <div id="contentScroll" class="offset-md-1 col-md-10">
        @yield('content')
    </div>
</div>

@include('layouts._footer')

</body>

注意:

body里面要套d-flex和flex-column

在div中要套一个container-fluid,这里都是使用的bootstrap

然后对应的js从:

$(document).ready( function() {

        $("html").niceScroll();
    } );

改成:

$(document).ready( function() {

        $("#mainDiv").niceScroll("#contentScroll");
    } );

即可。

对应的css要改成:

html,body{
    height: 100%;
    width: 100%;
}

html{
    overflow-x: hidden;
    overflow-y: hidden;
}

footer{
    bottom:0;
    width:100%;
}

相关文章

微信公众号

最新文章

更多