After the pop-up message, click on the button a few seconds to jump to a page

js code
    // clearTimeout role is to clear the setTimeout method. Or cancellation setTimeout method, let setTimeout method to stop or not to run. 
    // You must specify a parameter when using clearTimeout. This parameter is returned setTimeout ID value. That is when you use setTimeout. Id must specify a value returned by setTimeout. Optionally specify a variable 

    // set_id = the setTimeout (Fun, 1000); 
    // function Fun () { 
    $ (Document) .on ( "the Click", ".clickme", function (Event) { 
        $ ( "later-.read -alert " ) the .Show (); 
        set_id = the 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 code
<button class="clickme">点我啊</button>

    <div class="read-later-alert" style="display:none">31465465</div>
View Code
css code
   .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

 

Guess you like

Origin www.cnblogs.com/heyiming/p/11331481.html