-1

The script does not work, and the ebugging screen shows the error

$ is not defined

<script href="https://code.jquery.com/jquery-3.3.1.min.js"></script>

<script type="text/javascript">
    $(window).on('scroll', function(){
        if($(window).scrollTop()){
            $('nav').addClass('black');
        }else{
            $('nav').removeClass('black');
        }
    })
random_user_name
  • 25,694
  • 7
  • 76
  • 115

1 Answers1

2

This line:

<script href="https://code.jquery.com/jquery-3.3.1.min.js"></script>

You must edit "href" to "src"

Lee
  • 418
  • 2
  • 8