最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Bootstrap Scrollspy源碼學(xué)習(xí)

 更新時間:2017年03月02日 09:04:10   作者:alexZhangkai  
這篇文章主要介紹了Bootstrap Scrollspy源碼學(xué)習(xí),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Bootstrap Scrollspy插件的具體代碼,供大家參考,具體內(nèi)容如下

導(dǎo)航欄Scrollspy例子

<!-- The scrollable area -->
<body data-spy="scroll" data-target=".navbar" data-offset="50">

<!-- The navbar - The <a> elements are used to jump to a section in the scrollable area -->
<nav class="navbar navbar-inverse navbar-fixed-top">
...
 <ul class="nav navbar-nav">
 <li><a href="#section1" rel="external nofollow" rel="external nofollow" >Section 1</a></li>
 ...
</nav>

<!-- Section 1 -->
<div id="section1">
 <h1>Section 1</h1>
 <p>Try to scroll this page and look at the navigation bar while scrolling!</p>
</div>
...

</body>

垂直Scrollspy例子

<body data-spy="scroll" data-target="#myScrollspy" data-offset="20">

 <div class="container">
 <div class="row">
  <nav class="col-sm-3" id="myScrollspy">
  <ul class="nav nav-pills nav-stacked">
   <li><a href="#section1" rel="external nofollow" rel="external nofollow" >Section 1</a></li>
   ...
  </ul>
  </nav>
  <div class="col-sm-9">
  <div id="section1"> 
   <h1>Section 1</h1>
   <p>Try to scroll this page and look at the navigation list while scrolling!</p>
  </div> 
  ...
  </div>
 </div>
 </div>

</body>


Scrollspy的使用

使用Scrollspy只需在對應(yīng)的HTML元素里添加幾個關(guān)鍵的屬性:
- data-spy=”scroll”
添加到需要滾動的元素中,比如最常見的body元素,或者container。
- data-target=”selector”
添加到需要滾動的元素中,selector指示的是控制滾動的元素比如”.navbar”, “#myScrollspy”。
- <a href=”#section”>section</a>
在控制滾動的元素中用link鏈接到對應(yīng)的位置。注意鏈接的id要跟對應(yīng)位置元素的id相匹配。例如,<div id=”section1”>與<a href=”#seciton1”。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

宣化县| 邓州市| 常宁市| 和平县| 大连市| 龙岩市| 阿拉善盟| 克什克腾旗| 扶沟县| 文山县| 陆良县| 呼玛县| 庆安县| 剑川县| 龙南县| 贵港市| 内丘县| 武平县| 郯城县| 灌云县| 东乡| 大兴区| 武城县| 古丈县| 伊川县| 西城区| 佛教| 静安区| 会昌县| 安溪县| 嘉祥县| 高州市| 黑水县| 邵阳市| 永春县| 锦州市| 礼泉县| 新干县| 务川| 桂东县| 菏泽市|