Domanda

<!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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top