Where to put javascript?

Posted 5 months ago by artisticre

I have a very simple javascript for changing colors of the navbar. My question is where in laravel do I put javascript? I tried in app.blade.php in the header and before the closing body tag but it isn't working.

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

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.