zoukankan      html  css  js  c++  java
  • 点击按钮后弹出提示信息,几秒之后跳转到某页面

    js代码
        //clearTimeout的作用是清除setTimeout的方法.或者说注销setTimeout方法,让setTimeout方法停止或无法运行.
        // 使用clearTimeout时必须指定一个参数.该参数是setTimeout返回的ID值.也就是说当你使用setTimeout时.必须要为setTimeout指定一个返回的id值.随意指定一个变量
    
        // set_id=setTimeout(fun,1000);
        // function fun(){
        $(document).on("click", ".clickme", function (event) {
            $(".read-later-alert").show();
            set_id = setTimeout(function () {
                $(".read-later-alert").hide()
                window.location.href='../addTower.html'
            }, 3000);
           
            //  $(".read-later-alert").hover(function(){
            //      clearTimeout(set_id);
            //  },function(){
            //      $(this).hide();
            //  })
        });
        
        // }
    View Code
    html代码
    <button class="clickme">点我啊</button>
    
        <div class="read-later-alert" style="display:none">31465465</div>
    View Code
    css代码
       .read-later-alert {
                position: absolute;
                top: 50%;
                left: 40%;
                height: 40px;
                background: rgba(48, 48, 48, 0.8);
                padding: 10px;
                -moz-border-radius: 7px;
                -webkit-border-radius: 7px;
                color: #fff;
                position: fixed;
                display: none;
                text-align: center;
                z-index: 9999;
            }
    View Code
  • 相关阅读:
    75分以下是文盲
    罗永浩最近怎么了
    北京奥运会赛事项目竞赛日程表
    从今天开始我的blog增加计数器
    07工作总结
    五道脑筋测试题,全答对的是天才
    转:国家名字的含义
    我的新装备双狂
    上海海鲜自助:喜多屋vs古象大酒店
    因为有了爱
  • 原文地址:https://www.cnblogs.com/heyiming/p/11331481.html
Copyright © 2011-2022 走看看