smcclendon
smcclendon

Reputation: 3

jQuery slideDown script not working in simple code example

<!DOCTYPE html>
<html>
    <head>
        <title>
        </title>
        <style>
        </style>
        <script type="text/javascript">
            $(document).ready(function {
          $('img').slideDown('slow');
      });
        </script>
    </head>
    <body>
        <img src="images\sjmak-music-logo.jpeg"/>
    </body>
</html>

The simple code example above is not working; I am attempting to simply make the image slide down from the top of the screen but it stays static. I also attempted to use 'display: none' on the image, but the image remains hidden instead of sliding down from the top.

Upvotes: 0

Views: 315

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You need to include jQuery library file to use jQuery methods.

In the below sample a jquery cdn version is added. Also to slide down an image it has to be hidden first

<!DOCTYPE html>
<html>
    <head>
        <title>
        </title>
        <style>
        </style>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
          $('img').slideDown('slow');
      });
        </script>
    </head>
    <body>
        <img src="images\sjmak-music-logo.jpeg" style="display: none"/>
    </body>
</html>

Demo: Fiddle

Upvotes: 6

Related Questions