我正在使用twitter boostrap的popover来创建一个显示用户信息的悬停卡,我在这里触发mouseover检查jsfiddle上的popover.我想在它徘徊时保持这个popover活着.
<a href="#" id="example" class="btn btn-danger" rel="popover" >hover for popover</a>
$('#example').popover({
html : true,
trigger : 'manual',
content : function() {
return '<div class="box"></div>';
}
});
$(document).on('mouseover', '#example', function(){
$('#example').popover('show');
});
$(document).on('mouseleave', '#example', function(){
$('#example').popover('hide');
});
Run Code Online (Sandbox Code Playgroud)
你可以想到facebook悬停卡的工作.我想以同样的方式.我怎样才能做到这一点?
我在反应中使用 material-ui。假设我有这些样式的组件
const useStyles = makeStyles(theme => ({
outerDiv: {
backgroundColor: theme.palette.grey[200],
padding: theme.spacing(4),
'&:hover': {
cursor: 'pointer',
backgroundColor: theme.palette.grey[100]
}
},
addIcon: (props: { dragActive: boolean }) => ({
height: 50,
width: 50,
color: theme.palette.grey[400],
marginBottom: theme.spacing(2)
})
}));
function App() {
const classes = useStyles();
return (
<Grid container>
<Grid item className={classes.outerDiv}>
<AddIcon className={classes.addIcon} />
</Grid>
</Grid>
);
}
Run Code Online (Sandbox Code Playgroud)
我想使用上面的样式将鼠标悬停在 externalDiv 上时更改 addIcon 的样式。
这是我的例子:https : //codesandbox.io/s/trusting-mcnulty-b1gcd?fontsize=14&hidenavigation=1&theme=dark
我将如何实现类似于此网站的产品组合页面Solid Giant,CSS和HTML的效果?
我原以为只要放这样的东西就可以了:
a img{
margin-top: 5px;
}
a img:hover{
margin-top: 0px;
}
Run Code Online (Sandbox Code Playgroud)
但它没有用,即使我把:悬停在链接而不是img上.我仔细检查了他的代码和css,但我不能为我的生活弄清楚这一点.请帮忙 :)
我是谷歌chrome扩展的新手,我正在尝试编写一个扩展,突出显示div,以防鼠标位于它上面(悬停).如果在另一个div中有div,我想强调内部div.
我有一些样品正在工作,但我不知道如何捕捉悬停事件,提前感谢您的帮助,
快乐,享受生活.
在android文档中,它提到支持自4.0以来的"悬停"事件(即API级别14及以上).但不知何故,它不起作用.即使我在ApiDemo中试用了示例代码,它来自Android Sample,但它没有用.我目前的设备是Android 4.0.4.我应该升级到4.2.2吗?
示例代码如下所示.你有解决方案吗?非常感谢.
码:
View container = findViewById(R.id.container);
container.setOnHoverListener(new View.OnHoverListener() {
@Override
public boolean onHover(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_HOVER_ENTER:
mMessageTextView.setText(Hover.this.getResources().getString(
R.string.hover_message_entered_at,
event.getX(), event.getY()));
break;
case MotionEvent.ACTION_HOVER_MOVE:
mMessageTextView.setText(Hover.this.getResources().getString(
R.string.hover_message_moved_at,
event.getX(), event.getY()));
break;
case MotionEvent.ACTION_HOVER_EXIT:
mMessageTextView.setText(Hover.this.getResources().getString(
R.string.hover_message_exited_at,
event.getX(), event.getY()));
break;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
我已经查看过以前的问题,但没有一个真的对我有用,我已经检查了谷歌,我发现的信息看起来很模糊,所以我想我会试试这里.
是否有人知道/或已经解决了悬停时显示标题标签的问题.我有一系列链接和图像将分配标题标签,但是,其中一些将显示最好不要在悬停时弹出的信息.
是否有一个全局函数可以用来将它应用于所有标题标签?一个例子如下:
<a href="service.php" title="services for cars" />
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我想禁用悬停时出现的"汽车服务"标题.
再次感谢.
我创建了一个游戏,其中如果用户按下按钮,它将沿特定方向移动蛇。
而是当您按下按钮时,我要这样做,以便当手指悬停在按钮上时,蛇会移动。
所以我将方法从更改setOnTouchListener
为setOnHoverListener
这是我的代码:
Button btnRight = (Button) findViewById(R.id.btnRight);
btnRight.setOnHoverListener(new OnHoverListener(){
public boolean onHover(View v, MotionEvent event) {
if(direction!=4)
direction = 6;
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
当手指在屏幕上按下并在按钮上拖动时,什么也没有发生。
当手指在按钮上拖动时,如何注册它?有没有简单的方法解决方案,还是我必须检测坐标等?
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.currentTime = 0;
thissound.Play();
}
function StopSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Stop();
}
Run Code Online (Sandbox Code Playgroud)
这是我播放音频文件的代码,
onmouseover="EvalSound('sound1')" onmouseout="StopSound('sound1')"
Run Code Online (Sandbox Code Playgroud)
它目前正在进行悬停,但是当我回到它下面播放的图像时它不会回到开头,它会继续播放
我正在尝试在鼠标悬停时为单个项目设置动画。我遇到的问题是,每个项目在鼠标悬停在某个项目上时都会产生动画,而不仅仅是该特定项目。这是我所拥有的:
struct ContentView : View {
@State var hovered = false
var body: some View {
VStack(spacing: 90) {
ForEach(0..<2) {_ in
HStack(spacing: 90) {
ForEach(0..<4) {_ in
Circle().fill(Color.red).frame(width: 50, height: 50)
.scaleEffect(self.hovered ? 2.0 : 1.0)
.animation(.default)
.onHover { hover in
print("Mouse hover: \(hover)")
self.hovered.toggle()
}
}
}
}
}
.frame(minWidth:300,maxWidth:.infinity,minHeight:300,maxHeight:.infinity)
}
}
Run Code Online (Sandbox Code Playgroud)
onhover ×10
android ×2
css ×2
jquery ×2
animated-gif ×1
audio ×1
button ×1
hover ×1
html ×1
javascript ×1
jss ×1
material-ui ×1
onmouseout ×1
onmouseover ×1
popover ×1
popup ×1
reactjs ×1
swiftui ×1
title ×1