乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      javascript-如何使容器中的滾動(dòng)默認(rèn)情況下從某個(gè)鏈接開始?

       印度阿三17 2019-10-26

      https:///jimjamjom/pen/oBoEgz

      請(qǐng)參閱上方的代碼筆.基本上,當(dāng)有人訪問該頁(yè)面時(shí),默認(rèn)情況下,容器應(yīng)設(shè)置為“第3節(jié)”,然后他們需要向上或向下滾動(dòng)才能看到其余內(nèi)容.

      我已經(jīng)嘗試過了,但失敗了.

      <li class="active">
      <a href="#section3">Section 3</a>
      </li>
      
      <head>
        <title>Bootstrap Example</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn./bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://ajax./ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="https://maxcdn./bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script>
       $(window).load(function() {
         $('html, body').animate({
            scrollTop: $('#section3').offset().top}, 1000);
      });
      });
        </script>
        <style>
        body {
            /*position: relative; */
        }
        #section1 {padding-top:50px;height:500px;color: #fff; background-color: #1E88E5;}
        #section2 {padding-top:50px;height:500px;color: #fff; background-color: #673ab7;}
        #section3 {padding-top:50px;height:500px;color: #fff; background-color: #ff9800;}
        #section41 {padding-top:50px;height:500px;color: #fff; background-color: #00bcd4;}
        #section42 {padding-top:50px;height:500px;color: #fff; background-color: #009688;}
      
        </style>
      </head>
      
      
       <div class="container">
      <body data-spy="scroll" data-target=".navbar" data-offset="50">
      
      <nav class="navbar navbar-inverse">
       <div class="container">
        <div class="container-fluid">
        
          <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>                        
            </button>
          
           
          </div>
          <div>
          
            <div class="collapse navbar-collapse" id="myNavbar">
              <ul class="nav navbar-nav">
                <li><a href="#section1">Section 1</a></li>
                <li><a href="#section2">Section 2</a></li>
                <li class="active"><a href="#section3">Section 3</a></li>
                <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Section 4 <span class="caret"></span></a>
                  <ul class="dropdown-menu">
                    <li><a href="#section41">Section 4-1</a></li>
                    <li><a href="#section42">Section 4-2</a></li>
                  </ul>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </nav>    
      
      <div id="section1" class="page">
        <h1>Section 1</h1>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
      </div>
      <div id="section2" class="page">
        <h1>Section 2</h1>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
      </div>
      <div id="section3" class="container-fluid">
        <h1>Section 3</h1>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
      </div>
      <div id="section41" class="page">
        <h1>Section 4 Submenu 1</h1>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
      </div>
      <div id="section42" class="page">
        <h1>Section 4 Submenu 2</h1>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
        <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
      </div>
      </div>
      
      
      
      </body>

      解決方法:

      DOM準(zhǔn)備就緒后,您可以使用此代碼

      $(document).ready(function(){
        window.location.hash = "#"   "section3";
      });
      

      檢查pen

      來源:https://www./content-1-522751.html

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約