Why seems there is no JavaScript code until I scroll? : I just started using javascript, and I do not understand why my javascript code doesn't works until I start to scroll a little bit(so I see my logo and my menu page like there is no Javascript code). I don't understand also why it works only at the end of the body, and not in the tag head or by linking it.

    <script type="text/javascript">

      $(window).scroll(function() {
    var scrollPos = $(this).scrollTop();
      $(".textLogo").css({
        'font-size' : 690 - scrollPos + '%'
    });
      });

      $(window).scroll(function() {
    var scrollTop = $(this).scrollTop();
    $('.menu').css({
      opacity: function() {
        var elementHeight = $(this).height();
        return 1 - (elementHeight - scrollTop) / elementHeight;
      }
    });
      });

    </script>

CSS

    .textLogo{
     color: #1C1C1C;
     text-align: center;
     font-size: 110px;
     padding: 120px;
     position: absolute;
     margin-bottom: 800px;
     width: 100%;
    }