为了防止鼠标快速滑过div而加的时间限制:

在看延迟绑定时候看到,这也算是延迟绑定了?:(20130909)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title></title> </head>
<body> <div id="test" style="border: 1px solid #CCC; width: 100px; height: 100px; background: #666;">这是一个测试DIV
把鼠标放在上面2秒后会弹出他的ID</div>
<script type="text/javascript">
// <![CDATA[
var delay=function(t,fn){
var i=0,
j=10,
t=(t*1000)/j,
//把延迟时间平均分成10等份
_this=this,
//解决this绑定问题,所以调用delay函数的时候,请处理好this指向本身对象
d=setInterval(function(){
i++;
if(i==j){
clearInterval(d);
fn.apply(_this);
};
},t); _this.onmouseout=function(){
clearInterval(d);
}; }
document.getElementById("test").onmouseover=function(){
delay.apply(this,[2,function(){
alert(this.id)
}]);
//使用apply改变this指针
};
// ]]>
</script> </body>
</html>
 
(感觉在enter中应该要加一个clear,但是测试下来,感觉不加,也不会set更多的time 20130805)

$(".a").each(function(i) {
$(this).mouseenter(function(){
t=setTimeout("$('.div').eq("+i+").fadeIn()",500)
}).mouseleave(function(){
clearTimeout(t)
$(".div").eq(i).fadeOut();
}) });

不知道当时为啥会想得那么复杂 :

$(".list").mouseenter(function() {
if( $(this).data("time") ){
clearInterval( $(this).data("time") );
}
var _this = $(this);
$(this).data("time", setInterval(function(){
_this.children(".cover").animate({top: '0px'});
clearInterval( _this.data("time") );
_this.removeData("time");
},300));
}).mouseleave(function() {
if( $(this).data("time") ){
clearInterval( $(this).data("time") );
$(this).removeData("time");
}
$(this).children(".cover").animate({top: '145px'});
})

--------------------------------------------------------------------------setTimeout加参数20130805

var _sto = setTimeout;
window.setTimeout = function(callback,timeout,param)
{
var args = Array.prototype.slice.call(arguments,2);
var _cb = function()
{
callback.apply(null,args);
}
_sto(_cb,timeout);
}

--------------------------------------------------------------------------setTimeout加参数20130805
html:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>And the winner isn't...</title>
<style type="text/css">
a{width:100px; height:100px; background:#0FF; display: block; position:absolute}
.div{ width:100px; height:100px; background:#f36; display:none; position:absolute}
.warp{width:100px; height:100px; float:left; position:relative; margin:20px}
</style>
<script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".warp").each(function(i) {
$(this).mouseenter(function(){
t=setTimeout("$('.div').eq("+i+").fadeIn()",500)
}).mouseleave(function(){
clearTimeout(t)
$(".div").eq(i).fadeOut();
}) });
})
</script>
</head>
<body>
<div class="warp" style=" ">
<a href="#"></a>
<div class="div"></div>
</div>
<div class="warp">
<a href="#"></a>
<div class="div" style=""></div>
</div>
<div class="warp">
<a href="#"></a>
<div class="div" style=""></div>
</div> </body>
</html>
 

mouseenter和mouseout中间的时间控制的更多相关文章

  1. Tuxedo 超时时间控制(转贴)

    以下是转贴: TUXEDO超时控制全功略 摘要: 本<功略>集中了TUXEDO应用中,可能涉及到的所有时间参数,并分别对其进行详细描述,不但对其出处.取值等基本属性进行查证,而且,通过分析 ...

  2. 关于JS的时间控制实现动态效果及实例操作

    关于JS的时间控制 <script>        BOM   //Bowers Object Model   浏览器对象模型    setTimeout()//    延迟执行一次   ...

  3. Quartz定时器中Cron时间控制表达式写法

    Quartz定时器中Cron时间控制表达式写法:   1.表示形式 该表达式简洁简单,总共有7个空格分割的表达子式,形式为[* * * * * * *],而这七个位置上的东西表达方式有很多,意义从左往 ...

  4. Linux带有时间控制的多进程bash脚本

    目标 以可控制的多进程执行,达到最大执行时长后停止脚本. 思路 1.产生fifo管道,并预填充n个值(与并发数相等) 2.记录脚本本身PID并启动计时器进程(计时终止后杀脚本本身PID) 3.并发执行 ...

  5. java如何优雅的实现时间控制

    前言:最近小王同学又遇到了一个需求:线上的业务运行了一段时间,后来随着使用人数增多,出现了一个问题是这样的,一个订单会重复创建几次,导致数据库里出现了很多垃圾数据.在测试同学的不断测试下,发现问题出在 ...

  6. 最终解决 mouseenter, mouseleave , mouseout mousehover mousemove等事件的区别?

    在jquery中, html页面的div的显示和隐藏, 修改等的功能, 最终都要由 事件 触发来引用, 不管是键盘事件, 还是鼠标事件... mouseenter和mouseleave是成对对应的, ...

  7. mouseover,mouseenter,mouseleave,mouseout

    mouseover和mouseout对应 //鼠标移入移出触发该元素及子元素 mouseenter和mouseleave对应 //鼠标移入移出只触发该元素 看完例子即可知道其区别: mouseover ...

  8. WdatePicker()时间控制方式(转载+原创)

     控制时间在制定范围内: <input class="wzsrk" name="startDateStr" id="startDateStr ...

  9. linux下socket connect 阻塞方式 阻塞时间控制

    同事今天问我,如何在linux下的c代码里面控制connect的阻塞时间.应用的背景是:linux下的c程序有两个目标IP需要connect,如果用阻塞方式,当其中一个IP不能连接的情况下,程序将阻塞 ...

随机推荐

  1. Eclipse搭建Android5.0应用开发环境 “ndk-build”:launchingfailed问题解决

    Eclipse搭建Android5.0应用开发环境 "ndk-build":launchingfailed问题解决 详细参考http://blog.csdn.net/loongem ...

  2. 教你如何使用php session

    原文网址:http://www.jb51.net/article/42500.htm   学会php session可以在很多地方使用,比如做一个后台登录的功能,要让程序记住用户的session,其实 ...

  3. Java反序列化漏洞通用利用分析

    原文:http://blog.chaitin.com/2015-11-11_java_unserialize_rce/ 博主也是JAVA的,也研究安全,所以认为这个漏洞非常严重.长亭科技分析的非常细致 ...

  4. CG基础教程-陈惟老师十二讲笔记

    转自 麽洋TinyOcean:http://www.douban.com/people/Tinyocean/notes?start=50&type=note 因为看了陈惟十二讲视频没有课件,边 ...

  5. 基本的DMA控制器

    DMA的基本概念 直接内存访问(DMA)是一种完全由硬件执行I/O交换的工作方式.在这种方式中,DMA控制器从CPU完全接管对总线的控制,数据交换不经过CPU,而直接在内存和I/O设备之间进行 .DM ...

  6. 请求webservice接口的某方法数据

    NSURL *url = [NSURL URLWithString:@"http://xxx.xxx.com/xxx/xxxxWS?wsdl"]; NSString *soapMs ...

  7. maven实现依赖的“全局排除”

    大多数java应用源码构建和依赖管理是使用maven来实现的,maven也是java构建和依赖管理的事实上的标准.我们的应用系统也都是基于maven构建的,maven虽然在依赖管理方面确实很牛叉,但是 ...

  8. javascript中获取非行间样式的方法

    我们都知道一般在javascript中获取样式一般用的是nodeObj.style.attr这个属性的,但是这个属性只能获取行间样式非行间样式比如写在样式表中的样式那么用nodeObj.style.a ...

  9. [转载] linux cgroup

    原文: http://coolshell.cn/articles/17049.html 感谢左耳朵耗子的精彩文章. 前面,我们介绍了Linux Namespace,但是Namespace解决的问题主要 ...

  10. HTML字符实体

    常用实体符号: