jq commonly used functions

hide();

< Div class = "Box" > Big Box </ div > 
$ ( 'Box.') Hide (5000,. Function () { the console.log ( 'HHHHH' ); }); // hide () H is provided Hide elements // 5000 is the realization of this element with the effect disappeared within 5000ms // internal function is a callback function callback, the function is called after 5000ms
   // may not receive parameters
   parameter // callback is received after the end of a time value and execution

(CSS style shown)

Browser elements will gradually disappear, disappear after the console print

show();

   .hide-box {
        height: 200px;
        background-color: rgb(25, 99, 25);
        font-size: 60px;
        text-align: center;
        line-height: 200px;
        color: white;
        display: none;
    }


    <div class="hide-box">big box</div>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>

    <script>
        $('.hide-box').show(5000, function(){
            console.log('hhhhh');
        });
   </script>

show (); make a hidden button

For chestnut:

Click the button to make the picture display switching to hide

 .box {
        height: 200px;
        background-color: rgb(25, 99, 25);
        font-size: 60px;
        text-align: center;
        line-height: 200px;
        color: white;
    }


    <button class="btn">button</button>
    <div class="box">big box</div>

 

$ ( 'BTN.') the Click (. function () { 
            $ ( '.box') Toggle (5000,. function () { 
                the console.log ( . 11 ); 
                
            }); 
        }); 
        // can not receive parameters 
        / / can accept a time parameter, a switching time 
        // can accept a callback, the callback to perform a handover execution time

 

Guess you like

Origin www.cnblogs.com/sandraryan/p/11525968.html