Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <!-- add to the body tag scroll spy AND main-nav id to nav bar AND the id tags to the links AND those id's to the section -->
- <body id="home" data-spy="scroll" data-target="#main-nav">
- <nav class="navbar navbar-expand-md navbar-light fixed-top py-4" id="main-nav">
- <div class="container">
- <a href="#home" class="navbar-brand">
- <img src="img/mlogo.png" width="50" height="50" alt="logo">
- <h3 class="d-inline align-middle">Bootstrap-Sass</h3>
- </a>
- <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarCollapse">
- <ul class="navbar-nav ml-auto"><!-- ml-auto nustumia li i desine puse -->
- <li class="nav-item">
- <a href="#home" class="nav-link">Home</a>
- </li>
- <li class="nav-item">
- <a href="#about" class="nav-link">About</a>
- </li>
- <li class="nav-item">
- <a href="#authors" class="nav-link">Meet The Authors</a>
- </li>
- <li class="nav-item">
- <a href="#contact" class="nav-link">Contact</a>
- </li>
- </ul>
- </div><!-- end og collapse navbar-collapse -->
- </div><!-- end of container -->
- </nav>
- <section id="about" class="py-5 text-center bg-light"> ....
- <!-- under the body -->
- <script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
- crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
- crossorigin="anonymous"></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
- crossorigin="anonymous"></script>
- <script>
- // Get the current year for the copyright
- $('#year').text(new Date().getFullYear());
- // Init Scrollspy
- $('body').scrollspy({target: '#main-nav'});
- // Smooth Scrolling
- $("#main-nav a").on('click', function (event) {
- if (this.hash !== "") {
- event.preventDefault();
- const hash = this.hash;
- $('html, body').animate({
- scrollTop: $(hash).offset().top
- }, 800, function () {
- window.location.hash = hash;
- });
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement