Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

loading gif is not working at once

http://sitetrial.orgfree.com/

$('.loader').css({
   'display':'block'
});

$(window).load(function(){
      $('.loader').css({
       'display':'none'
    });

      $('nav li a').click(function(){
         $(this).parent().siblings().children().removeClass("selected");
         $(this).addClass("selected");
      });
});

1 Answer

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Try to include your js files

<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>

inside of head section:

<head>
    <script type="text/javascript" src="js/script.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
</head>

As far as I can see your DOM is already loaded and you wont see result of this code:

$('.loader').css({
   'display':'block'
});