兼容所有浏览器的滚动条适配
使用
jquery.nicescroll插件地址
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery NiceScroll Test Page</title>
<style type="text/css">
body{
margin: 0;
padding: 0;
}
#boxscroll4 {
height: 800px;
background-color: #00FF66;
}
#boxscroll{
height: 200px;
width: 300px;
background-color: lightseagreen;
}
</style>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/jquery.nicescroll.min.js"></script>
<script>
$(document).ready(function() {
var nice = $("html").niceScroll();
$("#boxscroll").niceScroll({
cursorborder:"",cursorcolor:"#00F",boxzoom:false});
});
</script>
<meta name="viewport" content="user-scalable=no" />
</head>
<body>
<div id="boxscroll4">
<div id="boxscroll">
<div style="height: 400px;width: 100%"></div>
</div>
</div>
</body>
</html>