亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

觸發(fā)onscroll事件

オリジナル 2019-05-10 10:46:00 284
サマリー:<!DOCTYPE html><html>         <head>         <title></title>    &nb

<!DOCTYPE html>

<html>

         <head>

         <title></title>

         <style type="text/css">

         *{margin:0 0;}

         .my_menu{

         width:100%;

         height:70px;

         background:#ccc;

         line-height:70px;

         text-align:center;

         }

         .my_body{

         width:100%;

         height:1600px;

         background:pink;

         }

         input{

                 border:1px solid #ccc;

                 width:500px;

                 height:30px;

                 border-radius:10px;

                 outline:none;

                 padding:2px 20px;

                 font-size:20px;

                 }

             .fix_menu{

                             width:100%;

                             height:70px;

                             background:#ccc;

                             line-height:70px;

                             text-align:center;

                             position:fixed;

                             display:none;

                             top:0;

                             }


                  </style>

             </head>

         <body>

         <div class="my_menu">

                      <input type="" name="">

         </div>

         <div class="fix_menu">

                      <input type="" name="">

         </div>

                      <div class="my_body">

         </div>

         <script type="text/javascript">

                     window.onload=function(){

                                  var dis_menu=document.getElementsByClassName('fix_menu');

                                    //當(dāng)滾動欄坐標(biāo)大于100px時觸發(fā)事件

                                  window.onscroll=function(){

                                              if(document.documentElement.scrollTop>100){

                                                              dis_menu[0].style.display='block';

                                                          }

                                              else{

                                                         dis_menu[0].style.display='none';

                                                     }

                                        }

                               }

                       </script>

              </body>

    </html>


添削の先生:查無此人添削時間:2019-05-10 13:40:56
先生のまとめ:章節(jié)是html基礎(chǔ),你的作業(yè)都寫成js事件了。厲害了,繼續(xù)加油

手記を発表する

人気のある見出し語