【发布时间】:2022-01-13 07:33:01
【问题描述】:
我在我的 ReactJS 项目中使用 malihu-custom-scrollbar-plugin,我可以通过编辑 node_modules 中的 css 来自定义滚动条,npm install 后这里的问题 node_modules 中的所有更改都会消失,我需要一种编辑滚动条拖动器的大小、颜色和滚动条导轨的方法。还有向上和向下按钮,在 src 文件中,而不是在节点模块中
这是我用于 malihu-custom-scrollbar-plugin 的代码:
import Box from '@mui/material/Box'
import $ from 'jquery';
import 'malihu-custom-scrollbar-plugin';
import 'malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css';
require('jquery-mousewheel');
const ListComponent = () => {
React.useEffect(()=>{
$('.scroll').mCustomScrollbar({
scrollButtons:{enable:true},
theme:"rounded-dots-dark",
scrollInertia:500
});
},[])
return (
<Box style={{overflowY: "hidden",
height: "300px"}} className='scroll'>
<p> A long lines of text</p>
</Box>
)
}
【问题讨论】:
标签: jquery css reactjs scrollbar mcustomscrollbar