我正在使用jquery颜色来生成一些随机颜色.我喜欢这些颜色,当用户将鼠标悬停在任何单选按钮标签上时.
按照这个网站上的例子,我想我可能会尝试:
spectrum();
function spectrum(){
var hue = ('lots of stuff here that generates random hue -- code on example webpage')
$('label').hover(function() {
$(this).animate( { color: hue }, 10000) });
spectrum();
}
Run Code Online (Sandbox Code Playgroud)
我的悬停选择器不起作用,一切都保持默认颜色.我显然是以某种方式搞砸了这个,但我没有足够的经验来理解出了什么问题.有什么建议?
开hoverIn- 我想要附加一个方框,将其向上滑动.
在hoverOut-框应该滑下去,然后取出盒
在一个简单的列表上它完美地工作,我可以将鼠标悬停在滑动元素上.但是如果我正在使用图像,当我尝试将鼠标悬停在滑动元素上时会产生闪烁效果.
将鼠标悬停在元素上,然后尝试将光标鼠标悬停在出现的红色框上.这有什么区别,我错过了什么吗?
对于相关对象和类似情况,我还需要使用stopPropagation吗?无法理解它.
我正在使用html5的拖放功能来重新排列屏幕上的dom元素 - 当我这样做时,我将css行为附加到拖放的各种状态,但我遇到的问题是悬停状态甚至在我之后仍然存在从DOM元素中拖出,删除和挖出.这是我的代码:
JAVASCRIPT:
function addDragListeners(){
$('.segmentListItem').each(function(index){
$(this)[0].addEventListener('dragstart',handleDragStart,false); //rollover for current
$(this)[0].addEventListener('drop',handleDrop,false); //drops dragged element
$(this)[0].addEventListener('dragover',handleDragOver,false); //allows us to drop
$(this)[0].addEventListener('dragenter',handleDragEnter,false); //rollover for target
$(this)[0].addEventListener('dragleave',handleDragLeave,false); //sets dragged item back to normal
$(this)[0].addEventListener('dragend',handleDragEnd,false); //sets all back to normal
});
}
function handleDragEnter(e) {
// this / e.target is the current hover target.
this.classList.add('over');
}
function handleDragLeave(e) {
this.classList.remove('over'); // this / e.target is previous target element.
}
function handleDragEnd(e){
$('.segmentListItem').removeClass('over'); //removes the over class on all elements
}
function handleDragStart(e){
draggedItem …Run Code Online (Sandbox Code Playgroud) 我想为我的自定义Swing.JButton添加一个悬停效果,类似于Chrome浏览器上的图标:
在悬停之前>>

悬停后>>

我可以在创建按钮时将其设置为"之前"状态,但是当它悬停时我无法创建"边框+凸起背景".当我尝试将边框重新添加到按钮时,我在插入重新绘制新边框后获得了移动效果.
这是我目前的代码:
public class MyButton extends JButton implements MouseListener {
public MyButton(String iconPath, String toolTip) {
super(new ImageIcon(TipButton.class.getResource(iconPath)));
addMouseListener(this);
setBorder(null);
setBorderPainted(false);
setFocusPainted(false);
setOpaque(false);
setContentAreaFilled(false);
setToolTipText(toolTip);
}
public MyButton(String iconPath, String name, String toolTip) {
this(observers, iconPath, toolTip);
setText(name);
}
@Override
public void mouseClicked(MouseEvent e) {}
@Override
public void mousePressed(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {
if (e.getSource() != this) return;
setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
}
@Override
public void mouseExited(MouseEvent e) {
if …Run Code Online (Sandbox Code Playgroud) 我的标签上的CSS转换不是淡入淡出,它就像没有转换一样!我尝试过使用transition: background 300ms ease-in-out;但仍然没有运气
CSS:
.FeatureRow a{
padding: 10px;
display: block;
width: 260px;
height: auto;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-webkit-box-shadow: 0px 4px 8px #f5f5f5;
-moz-box-shadow: 0px 4px 8px #f5f5f5;
box-shadow: 0px 4px 8px #f5f5f5;
background-image: -moz-linear-gradient(top,#fbfbfb,#ffffff);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#fbfbfb),to(#ffffff));
background-image: -webkit-linear-gradient(top,#fbfbfb,#ffffff);
background-image: -o-linear-gradient(top,#fbfbfb,#ffffff);
background-image: linear-gradient(to bottom,#fbfbfb,#ffffff);
background-repeat: repeat-x;
transition: all 300ms ease-in-out;
-webkit-transition: all 300ms ease-in-out;
-moz-transition: all 300ms ease-in-out;
-ms-transition: all 300ms ease-in-out;
-o-transition: all 300ms ease-in-out;
}
.FeatureRow a:hover{
background-image: -moz-linear-gradient(top,#C00,#C0F);
background-image: -webkit-gradient(linear,0 …Run Code Online (Sandbox Code Playgroud) 当你将鼠标悬停在div上时,我试图让我的页面滚动.这是我到目前为止所得到的
$(document).ready(function() {
$("#hoverscroll").mouseover(function() {
var div = $('body');
setInterval(function(){
var pos = div.scrollTop();
div.scrollTop(pos + 1);
}, 100)
});
});
Run Code Online (Sandbox Code Playgroud)
但是,还有两件事要做.我需要它在每次单击时提高速度,在不再悬停时停止并将速度重置为默认值.
我正在努力实现这样的目标:
$(document).ready(function() {
$("#hoverscroll").mouseover(function() {
var div = $('body');
setInterval(function(){
var count = 1;
var pos = div.scrollTop();
div.scrollTop(pos + count);
}, 100)
});
$("#hoverscroll").click(function() {
if (count < 6) {
count = count+1;
}
});
$("#hoverscroll").mouseleave(function() {
count = 0;
});
});
Run Code Online (Sandbox Code Playgroud)
我搜索并发现有些人在谈论绑定事件并设置一个全局变量来检查它是否在滚动.但上述功能会起作用吗?我仍在学习.我可能完全错了.
我想强调鼠标悬停在我的行上QTableWidget.
当我悬停鼠标时,只突出显示单个单元格.
我试过这种方法:
bool MyTabWidget::eventFilter(QObject *target, QEvent *event)
{
if( target == ui->MyTableWidget )
{
//Just to print the event type
qDebug() <<"EventType : "<<event->type();
}
}
Run Code Online (Sandbox Code Playgroud)
输出: EventType : 13.
`(13 = QEvent::Move)`
Run Code Online (Sandbox Code Playgroud)
我已经迷失了谷歌搜索.但没有得到任何适当的解决方案
有没有其他方法来满足我的要求(突出显示鼠标悬停的整行)?
请帮忙.预先感谢.
编辑:
请参考下面的屏幕截图更清晰.

这是我QTableWidget
想要在鼠标悬停时更改红色边框(已编辑)行的背景颜色.
我想做与此示例完全相同的事情: http: //jsfiddle.net/ThinkingStiff/rUhCa/。
但是,当我尝试更改表格的背景颜色时,悬停和突出显示停止工作。
下面你可以看到我的代码:
超文本标记语言
<table>
<tr>
<th></th>
<th class="col">50kg</th>
<th class="col">55kg</th>
<th class="col">60kg</th>
</tr>
<tr>
<th class="row">160cm</th>
<td>20</td>
<td>21</td>
<td>23</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
CSS
table {
border-spacing: 0;
border-collapse: collapse;
overflow: hidden;
z-index: 1;
}
td, th, .row, .col {
cursor: pointer;
padding: 10px;
position: relative;
}
td:hover::before,
.row:hover::before {
background-color: #ffa;
content: '\00a0';
height: 100%;
left: -5000px;
position: absolute;
top: 0;
width: 10000px;
z-index: -1;
}
td:hover::after,
.col:hover::after {
background-color: #ffa;
content: '\00a0';
height: 10000px;
left: 0; …Run Code Online (Sandbox Code Playgroud) 要在 Chrome 中使用Grammarly,我使用键盘移动到拼写错误,然后我必须使用触控板启用Hover,以便 Grammarly 可以提出建议。
我们如何使用键盘(没有鼠标和触控板)来做到这一点(强制悬停)?
有什么方法可能有效吗?- 可能是来自 Grammerly、chrome 扩展或 Mac 的快捷方式或隐藏设置的隐藏快捷方式。
谢谢。
谢谢 :)
macos google-chrome keyboard-shortcuts hover google-chrome-extension
plotly_express.line我看到修改悬停设置的唯一选项是hover_name和hover_data。我在修改悬停时面临的一些问题是:
看来即使我设置它仍然显示、和 的hover_data=None值。如何将其设置为仅显示我选择的悬停信息而不添加默认值?namexy
我找不到修改悬停框不透明度的设置。我显示了大量的悬停信息,因此我的悬停框很大,这使得很难知道我在框后面的绘图上的位置。
如何使其悬停在一行上显示与所有其他行上的链接数据列值相对应的悬停信息?
hover ×10
jquery ×4
css ×3
c++ ×1
click ×1
colors ×1
css3 ×1
events ×1
html-table ×1
java ×1
javascript ×1
jbutton ×1
macos ×1
mouseevent ×1
plotly ×1
plotly-dash ×1
python ×1
qt5 ×1
qtablewidget ×1
scroll ×1
swing ×1
transition ×1