Horje Website
Bs Scrollspy2 Stacked – Bootstrap Scrollspy – Bootstrap Scrollspy – Bootstrap Code

Bs Scrollspy2 Stacked – Bootstrap Scrollspy

Bs Scrollspy2 Stacked - Bootstrap Scrollspy - Bootstrap Scrollspy - Bootstrap Code


 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Bootstrap Example</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  8. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  9. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
  10. <style>
  11. body {
  12. position: relative;
  13. }
  14. ul.nav-pills {
  15. top: 20px;
  16. position: fixed;
  17. }
  18. div.col-sm-9 div {
  19. height: 250px;
  20. font-size: 28px;
  21. }
  22. #section1 {color: #fff; background-color: #1E88E5;}
  23. #section2 {color: #fff; background-color: #673ab7;}
  24. #section3 {color: #fff; background-color: #ff9800;}
  25. #section41 {color: #fff; background-color: #00bcd4;}
  26. #section42 {color: #fff; background-color: #009688;}
  27. @media screen and (max-width: 810px) {
  28. #section1, #section2, #section3, #section41, #section42 {
  29. margin-left: 150px;
  30. }
  31. }
  32. </style>
  33. </head>
  34. <body data-spy="scroll" data-target="#myScrollspy" data-offset="20">
  35. <div class="container">
  36. <div class="row">
  37. <nav class="col-sm-3" id="myScrollspy">
  38. <ul class="nav nav-pills nav-stacked">
  39. <li class="active"><a href="#section1">Section 1</a></li>
  40. <li><a href="#section2">Section 2</a></li>
  41. <li><a href="#section3">Section 3</a></li>
  42. <li class="dropdown">
  43. <a class="dropdown-toggle" data-toggle="dropdown" href="#">Section 4 <span class="caret"></span></a>
  44. <ul class="dropdown-menu">
  45. <li><a href="#section41">Section 4-1</a></li>
  46. <li><a href="#section42">Section 4-2</a></li>
  47. </ul>
  48. </li>
  49. </ul>
  50. </nav>
  51. <div class="col-sm-9">
  52. <div id="section1">
  53. <h1>Section 1</h1>
  54. <p>Try to scroll this section and look at the navigation list while scrolling!</p>
  55. </div>
  56. <div id="section2">
  57. <h1>Section 2</h1>
  58. <p>Try to scroll this section and look at the navigation list while scrolling!</p>
  59. </div>
  60. <div id="section3">
  61. <h1>Section 3</h1>
  62. <p>Try to scroll this section and look at the navigation list while scrolling!</p>
  63. </div>
  64. <div id="section41">
  65. <h1>Section 4-1</h1>
  66. <p>Try to scroll this section and look at the navigation list while scrolling!</p>
  67. </div>
  68. <div id="section42">
  69. <h1>Section 4-2</h1>
  70. <p>Try to scroll this section and look at the navigation list while scrolling!</p>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </body>
  76. </html>



Try Your Self ->



Published:
October 4, 2020
Author:
admin
Category:
Bootstrap 3, Bootstrap Source Code
Views:
15

This article was posted in Bootstrap 3, Bootstrap Source Code and tagged , , . Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Horje © 2011 - 2023