欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

JS如何實(shí)現(xiàn)滾動(dòng)到指定位置導(dǎo)航欄固定頂部

小編給大家分享一下JS如何實(shí)現(xiàn)滾動(dòng)到指定位置導(dǎo)航欄固定頂部,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

成都創(chuàng)新互聯(lián)公司公司2013年成立,先為陵水黎族等服務(wù)建站,陵水黎族等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為陵水黎族企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

代碼:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>js滾動(dòng)到指定位置導(dǎo)航欄固定頂部</title>
    <style type="text/css">
       body{height: 2500px; margin: 0; padding: 0;}
      .banner{height: 250px; width: 100%; background: #e5e5e5;}
      .bignav{width: 100%; background: #000;}
      .nav{ background:#000; width: 1200px; margin: 0 auto; height: 45px;}
      .nav a{display: block; width: 200px;float: left; color: #fff; text-decoration: none; text-align: center; line-height: 45px;}
    </style>
  </head>
  <body>
    <div class="banner">
    </div>
    <div class="bignav" id="bignav">
      <div class="nav">
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
        <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >首頁</a>
      </div>
    </div>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <p>其他內(nèi)容</p>
    <script type="text/javascript">
      window.onscroll=function(){
        var topScroll =document.body.scrollTop;//滾動(dòng)的距離,距離頂部的距離
        var bignav = document.getElementById("bignav");//獲取到導(dǎo)航欄id
        if(topScroll > 250){ //當(dāng)滾動(dòng)距離大于250px時(shí)執(zhí)行下面的東西
          bignav.style.position = 'fixed';
          bignav.style.top = '0';
          bignav.style.zIndex = '9999';
        }else{//當(dāng)滾動(dòng)距離小于250的時(shí)候執(zhí)行下面的內(nèi)容,也就是讓導(dǎo)航欄恢復(fù)原狀
          bignav.style.position = 'static';
        }
      }
    </script>
  </body>
</html>

以上是“JS如何實(shí)現(xiàn)滾動(dòng)到指定位置導(dǎo)航欄固定頂部”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

新聞標(biāo)題:JS如何實(shí)現(xiàn)滾動(dòng)到指定位置導(dǎo)航欄固定頂部
URL網(wǎng)址:http://www.aaarwkj.com/article16/psosdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、小程序開發(fā)品牌網(wǎng)站設(shè)計(jì)、軟件開發(fā)電子商務(wù)、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營
国产午夜福利一区在线| 裸体性做爰免费视频网站| 日韩综合欧美激情另类| 97视频在线免费播放| 久久精品国产一区二区三| 亚洲美女高清一区二区三区| 国产精品福利手机在线观看| 国产一区二区三区免费有码视频| 国产91啦中文在线观看| 日韩黄色精品中文视频| 91在线视频国产网站| 久久激情日本人妻av免费| 人妻一区二区三区久久| 蜜桃视频中文字幕二区三区| 久久亚洲欧洲日本韩国欧美| 精品视频美女肉体亚洲| 精品国产91高清在线观看| 亚洲精品理论片在线观看| 久久碰国产一区二区三区| 人人妻人人澡人人爽人人dvd| 91激情黑丝在线观看| 久久婷婷国产综合色啪| 国产三级国产精品三级| 一区二区三区毛片视频| 精品亚洲美无人区乱码| 日韩一区二区三区av| 欧美日韩加勒比综合在线 | 欧美一区二区三区有限公司| 在线日韩中文字幕二区| 国产欧美日本精品视频| 粉嫩av一区二区三区四区| 一区二区高清中文字幕| 手机在线观看午夜小视频| 欧美一级午夜欧美午夜视频| 六月丁香花五月婷婷| 精品国产一区二区三区卡| 国产精品va在线观看入口| 欧美精品欧美激情免费区| 精品成人18亚洲av播放| 69国产精品久久久久久人| 91国产在线视频免费观看|