为了防止鼠标快速滑过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. ①创建项目testpackage ②在pack2.B中添加方法f ③在类A中添加如下三个成员变量:int型的私有变量i float型的变量f double型的公有变量d 在pack1.B的main方法中为对象a的成员变量f和d分别赋值为2和3 在pack2.C的main方法中为对象a的成员变量d赋值为3

    package pack1; public class A { private int i; float f; public double d; public float getF() { retur ...

  2. JS——JavaScript Confirm

    function show_confirm(){var r=confirm("Press a button!");if (r==true) { alert("You pr ...

  3. 面向对象的JavaScript系列一,创建对象

    1.最简单的创建对象方法 var person = new Object(); person.name = "sam wu"; person.age = 25; person.jo ...

  4. ubuntu14.04LTS 下storm单机版安装配置

    1.下载storm 的安装文件 http://www.apache.org/dyn/closer.cgi/incubator/storm/apache-storm-0.9.2-incubating/a ...

  5. 文字垂直居中,水平居中 a标签水平居中只要给他的父级设置text-align=center

    在说到这个问题的时候,也许有人会问CSS中不是有vertical-align属性来设置垂直居中的吗?即使是某些浏览器不支持我只需做少许的CSS Hack技术就可以啊!所以在这里我还要啰嗦两句,CSS中 ...

  6. iOS - OC NSData 数据

    前言 @interface NSData : NSObject <NSCopying, NSMutableCopying, NSSecureCoding> @interface NSMut ...

  7. server-pc--------------->lspci,lsusb,meminfo等配置信息

    安装yum install pciutils usbutils [root@server09 ~]# [root@server09 ~]# lspci00:00.0 Host bridge: Inte ...

  8. [转]ubuntu环境变量配置文件

    参考网址:http://www.bkjia.com/Linuxjc/1008127.html Ubuntu通常使用的几个配置文件主要有下面这几个: /etc/environment./etc/prof ...

  9. poj3667【线段树】/【类似权值线段树写法】

    题意:n个空房间.两种操作:1.选择最小的连续D个房间入住,并输出这连续D个房间的最小标号.2.将某个区间内的房间全部退房. #include <cstdio> #include < ...

  10. OCR识别-python版(一)

    需求:识别图片中的文字信息环境:windows系统 开发语言:python 使用工具类:1.pyocr 2.PIL 3.tesseract-ocr 步骤: 1.pyocr 网络通直接使用命令:pip ...