≡
  • 网络编程
  • 数据库
  • CMS技巧
  • 软件编程
  • PHP笔记
  • JavaScript
  • MySQL
位置:首页 > 网络编程 > HTML

html 实现5秒倒计时跳转首页

人气:922 时间:2018-09-17

这篇文章主要为大家详细介绍了html 实现5秒倒计时跳转首页,具有一定的参考价值,可以用来参考一下。

HTML经测试代码如下:

<div id="J_topBn" class="site-bn site-bn-20160224">
    <div class="container clearfix">
         <div class="site-bn-main">
              <h2 class="title">四海网</h2>
              <p class="desc">512pic十余项黑科技,很轻狠快</p>
              <div class="links"><a class="btn-link-common btn-link" href="http://www.q1010.com">立即打开</a></div>
         </div>
         <div class="close-box">
              <a class="close J_closeBn" href="javascript:void(0);"><i class="iconfont">关闭</i></a>
              <span class="counter J_counter"></span>
         </div>
    </div>
</div>
<div id="J_topBackdrop" class="site-bn-backdrop J_closeBn"></div>

css经测试代码如下:

.site-bn{display:none;position:fixed;_position:absolute;top:0;left:0;z-index:99;width:100%}
.site-bn .container{position:relative}
.site-bn-backdrop{display:none;position:fixed;_position:absolute;top:0;left:0;z-index:98;width:100%;height:1000px;background:#000;opacity:.3;filter:alpha(opacity=30)\9}
.site-bn-20160224{height:100%;background-color:#fff;background-color:rgba(255,255,255,0.95);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#f2ffffff",endColorstr="#f2ffffff")\9;-webkit-font-smoothing:antialiased}
.site-bn-20160224 .close-box{position:absolute;top:72px;right:225px;text-align:right;color:#ff6700}
.site-bn-20160224 .close{display:inline-block;*zoom:1;*display:inline;width:24px;height:24px;line-height:24px;border:1px solid #ff6700;font-size:12px;text-align:center;color:#ff6700}
.site-bn-20160224 .counter{display:block;line-height:2}
.site-bn-20160224 .btn-link{display:inline-block;*zoom:1;*display:inline;width:196px;height:48px;border:1px solid #ff6700;line-height:48px;text-align:center;color:#ff6700;font-size:16px}
.site-bn-20160224 .site-bn-main{margin-top:115px;text-align:center}
.site-bn-20160224 .site-bn-main .title{margin:0 0 10px;font-size:70px;color:#ff6700;line-height:1;font-family:'F5bfdf';font-weight:normal}
.site-bn-20160224 .site-bn-main .desc{margin:0 0 70px;font-size:20px;color:#ff6700}

.site-bn-bar{width:100%}
.site-bn-bar .container{position:relative}
.site-bn-bar .site-bn-bar-link{display:inline-block;*zoom:1;*display:inline;width:115px;height:32px;font-size:12px;line-height:32px;text-align:center;color:#fff;background:#000;vertical-align:4px}
.site-bn-bar .site-bn-bar-close{position:absolute;right:0;top:7px;width:46px;height:46px;font-size:28px;line-height:46px;text-align:center;background-color:#f1410a;color:#fff;opacity:.6;filter:alpha(opacity=60)\9}
JS经测试代码如下:

jQuery(function($){
    var $topBn = $('#J_topBn'),
        $topBnBackdrop = $('#J_topBackdrop'),
        $counter = $('.J_counter'),
        $closeBnTrigger = $('.J_closeBn'),
        timeoutTopBn,
        bnCounter = 5;
    function countDown(){
        bnCounter -=1;
        if(bnCounter < 1){
           closeBn();
        }else{
            $counter.text(bnCounter + ' 秒后关闭');
        }
    }
    function closeBn(){
        var expireDate = 7;
        window.clearInterval(timeoutTopBn);
        $counter.remove();
        $topBn.animate({'top':-$topBn.height()},1000,function(){
            $topBn.hide();
            $topBnBackdrop.hide();
        });
        // $.cookie('indexTopBn', '1', {
        //    expires: expireDate
       // });
    }
    function initTopBar(){
        $topBn.show();
        $topBnBackdrop.height($(document).height()).show();
        timeoutTopBn = window.setInterval(function(){
            countDown();
        },1000);
        $closeBnTrigger.on('click',function(e){
            e.preventDefault();
            closeBn();
        })
    }
    initTopBar();
});
// 来自:四海网(www.q1010.com) 

本文来自:http://www.q1010.com/175/89-0.html

注:关于html 实现5秒倒计时跳转首页的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。

关键词:倒计时

您可能感兴趣的文章

  • HTML 404页面倒计时跳转的实现代码
上一篇:HTML 404页面倒计时跳转的实现代码
下一篇:Chrome最小字体限制解决方法
热门文章
  • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
  • HTML,CSS,font-family:中文字体和英文名称对照表
  • html 回到顶部的完整代码
  • 百度编辑器ueditor自动排版首行缩进四个字符实现方法
  • HTML 为元素添加一些透明度的简单方法
  • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
  • HTML 在textarea中选择文本的实现方法
  • CSS分页符示例
  • 【推荐】DIV+CSS入门菜鸟教程
  • HTML 点击超链接在iframe框架显示的实现方法
  • 最新文章
    • css实现移动端禁止手机长按图片弹出保存图片
    • 鼠标拖动DIV元素的实现方法
    • html 标签随机变色大小的简单示例
    • HTML 在textarea中选择文本的实现方法
    • CSS分页符示例
    • HTML 为元素添加一些透明度的简单方法
    • html 回到顶部的完整代码
    • HTML5 文本内容显示三行,多余部分显示...,点击全部展开
    • HTML/CSS 实现div居中、div内部元素垂直居中的简单示例
    • HTML,CSS,font-family:中文字体和英文名称对照表

四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。