My coding tool is flagging errors in my JavaScript file, including:
-'$' usage before definition.
-Incorrect spacing between 'function' and '('
This is the content of my JS file:
$(document).ready(function() {
$(window).scroll(function() {
if ($(window).scrollTop() > 970) {
$('.navbar').addClass('navbar-fixed-top');
}
});
});
I am working with HTML, CSS, and JS. Despite placing the jQuery library link above my external .js file in my HTML document, it does not seem to be recognized. Here's a snippet from my HTML file:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
The error is occurring in the brackets editor I'm using
If anyone has insight on what might be causing this issue, I'd appreciate your input. Thank you!