- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
react-custom-scrollbars 的默认光标当您在滚动条上移动鼠标时是指针。
有没有办法改变光标样式?
目前这些都不起作用。
<Scrollbars style={{ cursor: 'default' }}>
<p>Some content</p>
</Scrollbars>
和
<Scrollbars className="my-style">
<p>Some content</p>
</Scrollbars>
.my-style {
cursor: default;
}
最佳答案
根据文档 ( https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/customization.md )
<Scrollbars
renderTrackHorizontal={props => <div {...props} className="track-horizontal"/>}
renderTrackVertical={props => <div {...props} className="track-vertical"/>}
renderThumbHorizontal={props => <div {...props} className="thumb-horizontal"/>}
renderThumbVertical={props => <div {...props} className="thumb-vertical"/>}
renderView={props => <div {...props} className="view"/>}>
<div>
content here
</div>
</Scrollbars>
然后应用下面的 css,让基础工作。并根据需要进行调整。
(在 SCSS 中)
.track-vertical {
top: 2px;
bottom: 2px;
right: 2px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.111);
.thumb-vertical {
position: relative;
display: block;
width: 100%;
cursor: pointer;
border-radius: inherit;
background-color: rgba(123, 154, 255, 0.418); // changed the color
}
}
.track-horizontal {
position: absolute;
height: 6px;
right: 2px;
bottom: 2px;
left: 2px;
border-radius: 3px;
.thumb-horizontal {
position: relative;
display: block;
height: 100%;
cursor: pointer;
border-radius: inherit;
background-color: rgba(125, 149, 255, 0.993); // changed the color
}
}
.view {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
overflow: scroll;
margin-right: -15px;
margin-bottom: -17px !important; // changed from -15px (default) to -17px (native scrollbar had a portion visible)
}
这是当我们不手动渲染元素时默认应用的样式。传递的 Prop 将处理更新拇指的尺寸。
不知道是不是故意的。所以我们可以自定义我们想要的方式,我们将不必在我们的 css 中使用 !important(看起来像那样!)。
对于 .view 元素。样式已通过,如果您想覆盖(因为我自己需要(边距:-17px,而不是-15px)),那么只需 css 规则。使用!重要。或者使用内联 css。
(在 CSS 中)
.track-vertical {
top: 2px;
bottom: 2px;
right: 2px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.111);
}
.track-vertical .thumb-vertical {
position: relative;
display: block;
width: 100%;
cursor: pointer;
border-radius: inherit;
background-color: rgba(123, 154, 255, 0.418);
}
.track-horizontal {
position: absolute;
height: 6px;
right: 2px;
bottom: 2px;
left: 2px;
border-radius: 3px;
}
.track-horizontal .thumb-horizontal {
position: relative;
display: block;
height: 100%;
cursor: pointer;
border-radius: inherit;
background-color: rgba(125, 149, 255, 0.993);
}
.view {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
overflow: scroll;
margin-right: -15px;
margin-bottom: -17px !important;
}
关于html - 如何更改 react-custom-scrollbars 的光标样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47066477/
我有一个包含透明区域的 png,并将其设置为图像标签。 当光标位于图像的不透明部分上时,如何将光标设置为手? 谢谢 最佳答案 为此,您需要查看位图本身。 WPF 的 HitTest 机制认为任何使用“
我想隐藏圆形仪表的手(那就是中间的东西,对吧?)。到目前为止,我尝试过: myCircularGauge.getHand().setVisible(false); 但是,绘制图表时这似乎会产生崩溃。如
我有两张图片:一张是张开的手,一张是抓着的手。我希望一个简单的“onmousedown”和“onmouseup”函数有助于制作出著名的抓手,您可以在类似谷歌地图的东西中看到它。但...抱歉,从头开始:
是否可以在sequelize迁移中使用光标?我正在尝试创建 DML 脚本,其想法是循环表中的值,即。使用游标输入日期,然后将值插入到其他表中,即。光标内的膳食日。 table : day dayId
我正在尝试使用格式加载值 +02:00 - mysql> select SUBSTR('2016-01-12T14:29:31.000+02:00',24,6); +02:00
我一直在尝试构建一个基于网络的文本编辑器。作为该过程的一部分,我正在尝试动态创建和修改基于元素的事件和用于字体编辑的击键事件。在这个特别的jsfiddle示例 我试图在按下 CTRL+b 并将焦点/插
我同时使用了 supertab 和 snipmate 插件。假设我正在使用 snipmate 创建一个 if 语句结构。在 if 语句中完成添加语句后,如何快速将光标移动到 if 语句之后。例如: i
我正在为我的 BlackBerry 项目创建一个搜索框,但看起来 BlackBerry 没有用于创建单行 EditField 的 API。我通过扩展 BasicEditField 和覆盖布局和绘制等方
我想知道如何获得 not-allowed光标在我禁用的链接上。我试图将它添加到禁用事件中,但它在那里不起作用,然后我尝试使用相同的光标事件引入悬停效果。关于如何让它发挥作用的任何想法?我在这里包含了我
在 Delphi 6 中,我可以使用 Screen.Cursor 更改所有表单的鼠标光标: procedure TForm1.Button1Click(Sender: TObject); begin
这个 Meteor 服务器代码需要每 n 秒从集合中打印一次文档,我该如何让它工作?谢谢 myCol.find({abc: undefined}).forEach( fun
在这个论坛上花了相当长的时间寻找与我的问题类似的答案,但找不到符合我的情况的答案。 我有一个 HTML 表单,通过 javascript 将其提交到我的 aspx 页面。 function Submi
是否可以在网页上创建透明的 HTML 光标?我使用 div 作为光标,我想让 div 50% 透明: http://jsfiddle.net/mCgmP/16/ I want this cursor
我正在使用 Cursor 来获取存储在我的 SQLite 数据库中的一些数据。当我的光标有数据库中的一些数据时,代码可以正常工作。但是,当 Cursor 不包含任何数据时,我在 Cursor.move
我希望隐藏特定范围的 x 和 y 位置中的光标。这是一些示例代码,代表了我想要做的事情。 if(x >= xLowerBound && x = yLowerBound + 20 && y = xLow
我有一个 .jsp 页面,用户可以在其中输入信息,然后使用保存按钮保存。该应用程序可以运行,但由于按钮的单击事件正在运行 Java 代码,然后将保存的信息添加到 Oracle 数据库,因此需要一些时间
为什么 Android 中 Cursor 没有 moveBeforeFirst()? 其他风格的 Java 中也有类似的方法,如果您需要重新迭代结果集(例如,在 while(cursor.moveTo
我想使用 Tkinter 捕获相对鼠标运动。我附上一个监听器并且能够获取鼠标移动。但是,我希望能够“捕获”/“锁定”光标,使其不可见并且无法离开窗口(就像游戏一样)。我的目标是获得相对鼠标移动而不受窗
当应用程序同步时,我尝试更新数据库中每一行的“html”列。我用过这个教程Here将应用程序添加到“配置文件”列表中。这是我在 SyncAdapter 中使用的代码: private static v
我正在使用 Uploadify带有图像按钮。一切正常。除了,我需要在鼠标悬停时使用 cursor:crosshair; 而不是 cursor:default;。 我试着在 CSS 中这样设置它: ob
我是一名优秀的程序员,十分优秀!