Sol mario animate hover

De wikiserver
Dreceres ràpides: navegació, cerca
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
        <style>

            img {
                position: relative;
                top:50px;
                left:250px;

            }

        </style> 

        <script>


            $(document).ready(function() {
                $('img').hover(function() {

                    $(this).animate({top: '-=50px'}, 500);
                },
                        function() {
                            $(this).animate({top: '+=50px'}, 500);
                        }
                );
            });

        </script>
    </head>
    <body>
        <img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/mario.jpg"/>
    </body>
</html>