首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

鼠标通过延迟时间 设置。

2012-07-30 
鼠标经过延迟时间 设置。。。JScript code$(document).ready(function() {//When page loads...$(.tab_conte

鼠标经过延迟时间 设置。。。

JScript code
$(document).ready(function() {    //When page loads...    $(".tab_content").hide(); //Hide all content    $("ul.tabs li:first").addClass("active").show(); //Activate first tab    $(".tab_content:first").show(); //Show first tab content    //On mouseover Event    $("ul.tabs li").mouseover(function() {        $("ul.tabs li").removeClass("active"); //Remove any "active" class        $(this).addClass("active"); //Add "active" class to selected tab        $(".tab_content").hide(); //Hide all tab content        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content        $(activeTab).fadeIn(); //Fade in the active ID content        return false;    });});
这段代码是控制 鼠标经过切换的,我想让延迟一下才切换(防止用户不经意的操作。。)谢谢啊

[解决办法]
window.setInterval( function() {/*你的代码*/}, 1000);
[解决办法]
可以的
javascript模拟sleep
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>javascript模拟sleep http://www.ok22.org幸凡在线学习,网页设计,技术交流区,在线学习网,免费视频教程</title></head><body><script>function Pause(obj,iMinSecond){      if (window.eventList==null) window.eventList=new Array();      var ind=-1;      for (var i=0;i<window.eventList.length;i++){          if (window.eventList[i]==null) {            window.eventList[i]=obj;            ind=i;            break;           }       }      if (ind==-1){      ind=window.eventList.length;      window.eventList[ind]=obj;      }     setTimeout("GoOn(" + ind + ")",iMinSecond);   }     //js继续函数  function GoOn(ind){     var obj=window.eventList[ind];     window.eventList[ind]=null;     if (obj.NextStep) obj.NextStep();     else obj();   }function testJsStop(){ //调用方法 alert("1");   Pause(this,2000);//2秒钟扣执行nextstep事件。。这样就可以设置下一个方法执行的开始时间 this.NextStep=function(){     alert("2");   }}  testJsStop();</script></body></html>
[解决办法]
不好意思,函数是这个setTimeout():

function test(){
 alert($("#input1").val());
}
$(function(){
$("#input1").click(function(){
 setTimeout("test()",1000);
});

});

热点排行
Bad Request.