使用jQuery设置微调器的延迟时间 [英] set a delay time for spinner using jquery

查看:74
本文介绍了使用jQuery设置微调器的延迟时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

堆栈溢出时的Hi Folks.我一直在寻找一种在网站上添加微调器的方法,但我发现了这个有用的代码,但我唯一缺少的是用于设置微调器的延迟或持续时间的代码,我真的很希望它显示为2秒.有什么建议...

Hi Folks at Stack Overflow. I was looking for a way to add a spinner on my website and I found this useful code but the only thing I'm missing is the code for setting the delay or duration on the spinner, I would really like it to show for like 2 seconds. Any suggestions...

<html>
<head>

<script type="text/javascript">
    $(window).bind("load", function() {
        $('#overlay').fadeOut(function() 
        {   

       $('#container').fadeIn();

        }); 

    });
</script>
</head>
<body>

    <div id="overlay">
         <img src="ajax-loader.gif" alt="Loading" />
         Loading...
    </div>
    <div id="container" style="display:none">

    </div>

</body>
</html>

推荐答案

点击演示,加载图片3秒钟然后显示内容[已解决]

<div id="overlay">
         <img src="http://cdn.nirmaltv.com/images/generatorphp-thumb.gif" alt="Wait" alt="Loading" />
         <div id="overlayText">

Wait  
Loading
    </div>
    </div>
    <div id="container"  >

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>

jQuery

var delay = 3000;
setTimeout(function() 

    {  

        $( "#overlay" ).fadeOut( "slow" );

         $('#container').fadeIn();

    },
    delay
) ;

CSS

#overlay >img{

    position:absolute;
    top:300px;
    left: 320px;

    z-index:10;


}


#overlayText{
     position:absolute;
    top:365px;
    left: 330px;

   z-index:11;

}
#container{
    position:relative;
       display:none;
}
#overlay{

  width:100%;
    height:100%;
    position: absolute;
    top:0px;
    z-index: 2;
    background-color:#222;
    opacity:0.7;



}

这篇关于使用jQuery设置微调器的延迟时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆