Javascript does not work :( [closed]

-4

Good morning.

Linke the javascript on my site as follows:

script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">

andoneofthecodesisthis,insertedjustafterthebody,tosetmenuafterscrolling:

<scripttype="text/javascript">
            jQuery("document").ready(function($){

            var nav = $('.menu');

            $(window).scroll(function () {
                if ($(this).scrollTop() > 10) {
                    nav.addClass("fixar");
                } else {
                    nav.removeClass("fixar");
                }
            });
    </script>

But nothing works, I've already tried the "hello world" to test the js but that does not even work. Anyone have any idea what might be working?

    
asked by anonymous 04.01.2018 / 15:40

1 answer

1

Friend structure should look like this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Teste</title>
  </head>
  <body>

  </body>
  <script src="https://code.jquery.com/jquery-1.12.4.min.js"integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
  // AGORA QUE O JQUERY FOI IMPORTADO, VOCÊ PODE COMEÇAR A ESCREVER SEUS CÓDIGOS QUE UTILIZAM A BIBLIOTECA.
 <script>
   $(function() {
    console.log( "ready!" );
   });
 </script>
</html>

Do not forget to consider separating Javascript from Javascript to improve readability.

    
04.01.2018 / 16:19