문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top