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">
<head>
<meta charset="utf-8"/>
<title>Page type</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<style>
.fade {
position: absolute;
top: 100px
left: 100px
}
.fade div {
position: absolute;
top: 0;
left: 0;
display: none;
}
</style>
<script>
// when the DOM is ready:
$(document).ready(function () {
$('div.fade').hover(function() {
// on hovering over, find the element we want to fade *up*
var fade = $('> div', this);
// if the element is currently being animated (to a fadeOut)...
if (fade.is(':animated')) {
// ...take it's current opacity back up to 1
fade.stop().fadeTo(300, 1);
} else {
// fade in quickly
fade.fadeIn(250);
}
}, function () {
// on hovering out, fade the element out
var fade = $('> div', this);
if (fade.is(':animated')) {
fade.stop().fadeTo(300, 0);
} else {
// fade away slowly
fade.fadeOut(300);
}
});
});
</script>
</head>
<body>
<div class="fade">
<a href="/info.html"><img src="image1.jpg" width="200" height="200" /></a>
<div>
<a href="/info.html"><img src="image2.jpg" width="200" height="200" /></a>
</div>
</div>
</body>
</html> |
Partager