兼容IE的滚动条适配方案

兼容所有浏览器的滚动条适配

在这里插入图片描述

使用

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();  // The document page (body)
    $("#boxscroll").niceScroll({
     
     cursorborder:"",cursorcolor:"#00F",boxzoom:false}); // First scrollable DIV
  });
</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>

猜你喜欢

转载自blog.csdn.net/qq_42068550/article/details/111662071