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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| <!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>
<style>
#BoItE {
width: 170px;
height: 150px;
}
</style>
<script>
'use strict';
var
wdmax = 170,
hdmax = 145,
ImAgE = "../images/boule7.png",
MiRoIr = "../images/boule1.png",
wdmin = 0,
hdmin = 0,
vIt = 50,
poI = 7000,
poM = 4000,
inc = 5,
PoE = "PoS"
function InVeRsE() {
"use strict";
if ( window.Am ){
setTimeout( InVeRsE, 1 );
return;
}
if ( PoE === "PoS" ) {
var wd = document.getElementById("PE").width;
wd = wd - inc;
document.getElementById("PE").width = wd;
if ( wd === wdmin ) {
document.getElementById("PE").src = ImAgE;
inc = -inc;
}
if ( wd === wdmax ) {
PoE = "pOe";
inc = -inc;
setTimeout( InVeRsE, poI);
} else {
setTimeout( InVeRsE, vIt );
}
} else {
var hd = document.getElementById("PE").height;
hd = hd - inc;
document.getElementById("PE").height = hd;
if ( hd === hdmin ) {
document.getElementById("PE").src = MiRoIr;
inc = -inc;
}
if ( hd === hdmax ) {
PoE = "PoS";
inc = -inc;
setTimeout( InVeRsE, poM );
} else {
setTimeout( InVeRsE, vIt );
}
}
}
document.addEventListener( 'DOMContentLoaded', function( ev ){
var
elemBoItE = document.querySelector( "#BoItE" );
elemBoItE.addEventListener( "mouseenter", function( ev ){
window.Am = 1;
});
elemBoItE.addEventListener( "mouseleave", function( ev ){
window.Am = 0;
});
});
window.addEventListener( 'load', function( ev ){
setTimeout( InVeRsE, 3000 );
});
</script>
</head>
<body>
<main>
<div id="BoItE">
<div id="ImAgE">
<a href="#">
<img id="PE" src="../images/boule1.png" width="170" height="145" lang="aba">
</a>
</div>
</div>
</main>
</body>
</html> |
Partager