Простая вроде задача, необходимо, чтобы ссылки в навигационной панели были выравнены по правому краю, а не по левому, как сейчас. Ничего не помогает.
$('body').scrollspy({
offset: 150,
target: '#my-nav'
});
$("#my-nav ul li a[href^='#']").on('click', function(e) {
var target = this.hash;
var offSet = $('.navbar').height() + 16;
e.preventDefault();
$('html, body').animate({
scrollTop: $(target).offset().top - offSet
}, 500, function() {
return window.history.pushState(null, null, target);
});
});
body {
position: relative;
padding-top: 45px;
}
.about {
background-color: #B6CBFC;
height: 400px;
margin: 10px 0px;
}
.portfolio {
background-color: #B7DBE8;
height: 400px;
margin: 10px 0px;
}
.contact {
background-color: #94A2B2;
height: 400px;
}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
</head>
<body>
<div class="container">
<nav id="my-nav" class="navbar navbar-dark navbar-fixed-top bg-primary">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#portfolio">Portfolio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact</a>
</ul>
</nav>
</div>
<div class="container-fluid">
<main>
<article class="my-page">
<section id="about" class="about">
About
</section>
<section id="portfolio" class="portfolio">
My portfolio
</section>
<section id="contact" class="contact">
Contact
</section>
</article>
</main>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
</body>