1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| <!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta http-equiv="cache-control" content="public, max-age=60">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Daniel Hagnoul">
<title>Test</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/le-frog/jquery-ui.min.css">
<style>
#box {
background-color: #9cf;
height: 50px;
position: relative;
width: 50px;
}
</style>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/i18n/jquery-ui-i18n.min.js"></script>
<script>
'use strict';
$( function(){
function goToRight(){
$('#box')
.animate({
'left' : ( $( document ).width() - 50 )
},
6000,
'linear',
function(){
$('#box')
.animate({
'left' : -10
},
6000,
'linear',
function(){
goToRight();
}
);
}
);
}
goToRight();
});
</script>
</head>
<body>
<div id="box"></div>
</body>
</html> |
Partager