Sol mario animate hover
De wikiserver
La revisió el 13:02, 1 abr 2016 per Jnoguera (Discussió | contribucions)
<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() {
$(document).keypress(function() {
$('img').animate({top: '-=50px'}, 500);
},
function() {
$('img').animate({top: '+=50px'}, 500);
}
);
});
</script>
</head>
<body>
<img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/mario.jpg"/>
</body>
</html>