如何设置此鼠标悬停显示,即使鼠标悬停超过3秒
How to set this mouseover to show even when mouseover morethan 3 sec only?
如何设置鼠标悬停超过3秒时显示
http://jsfiddle.net/peap/YVk6Z/317/$(function() {
$('#target').mouseenter(function() {
$(this).delay(1000).animate({height: '300px'});
});
$('#target').mouseleave(function() {
$(this).animate({height: '100px'});
});
});
当您在mouseenter
7上禁食CC_1, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
, mouseenter
, mouseleave
时,您将看到一个偶数循环
如果mouseenter
小于3秒甚至不显示
你总是可以使用.stop(true)
来清除动画队列:
演示小提琴
$(function () {
$('#target').mouseenter(function () {
$(this).stop(true).delay(3000).animate({
height: '300px'
});
});
$('#target').mouseleave(function () {
$(this).stop(true).animate({
height: '100px'
});
});
});
对于纯css,你可以这样做
<标题>现场演示h1> 风格:#target {
height: 100px;
background: red;
cursor: pointer;
transition: height 300ms 0s ease;/* animate height | in 300ms | with delay= 0s*/
}
#target:hover {
height: 300px;
transition: height 300ms 3s ease;/* animate height | in 300ms | with delay= 3s*/
}
标记:
<div id=target></div>
标题>
你可以设置一个变量,在鼠标退出时自动取消,然后基于mouseOut
为false延迟动画:
$(function() {
var mouseOut = true;
$('#target').mouseenter(function() {
mouseOut = false;
var that = $(this);
setTimeout(function(){
if(!mouseOut){
that.animate({height: '300px'});
}
}, 3000);
});
$('#target').mouseleave(function() {
mouseOut = true;
$(this).animate({height: '100px'});
});
});
演示:http://jsfiddle.net/robschmuecker/YVk6Z/321/
相关文章:
- 当鼠标悬停在文本中的单词上时显示警报
- d3.js鼠标悬停鼠标输出问题
- 悬停(鼠标离开)方法不显示效果
- 为什么addEventListener只执行我的函数,而不为其创建鼠标悬停/鼠标打开事件
- 在鼠标悬停/鼠标出类中的任何元素时更改元素 ID
- 检测鼠标悬停/鼠标单击,无论 Z 顺序/图层级别如何
- 悬停/鼠标悬停功能冲突
- 子元素的 JavaScript 鼠标悬停/鼠标退出问题
- 在 iPad 上触发悬停/鼠标退出/模糊
- 如何通过按钮单击和鼠标悬停/鼠标退出显示和隐藏节点文本?D3/JS.
- 背景图像在悬停/鼠标悬停时消失,菜单在IE中不起作用
- jQuery鼠标悬停/鼠标悬停将不适用于Live
- jQuery-悬停以在刷新时触发悬停/鼠标悬停
- 悬停/鼠标悬停未在元素内部的每次移动中激活
- HighCharts条形图:悬停鼠标时显示条形值
- 鼠标悬停/鼠标离开,鼠标进入/鼠标离开,鼠标悬停闪烁问题
- 滚动时未触发鼠标悬停/鼠标输入
- JavaScript-如何在鼠标悬停/鼠标悬停上同时更改TR中所有TD的背景颜色
- 记住并在悬停鼠标悬停后显示以前活动的导航选项卡
- JavaScript延迟CSS悬停/鼠标悬停效果