I connected everything, checked everything, the script still does not work.
<script src="jquery-3.1.1.min.js"></script> <script src="script.js"></script> The script itself:
$(document).ready(function() { if ($(document).scrollTop() > $('header').height() + 20) $('nav').addClass('fixed'); else $('nav').removeClass('fixed'); }); Styles:
#nav.fixed { width: 100%; position: fixed; top: 0; opacity: 0.97; } What is the problem?