Bonjour,
J'ai un site internet sur lequel je voudrais insérer du texte qui apparaît au survol d'une image. Exemple sur cette page :
http://www.queness.com/resources/htm...ail/index.html
J'ai donc copié le script de cette page, modifié les images, les dimensions et le texte.
Les images apparaissent correctement néanmoins l'effet de survol ne fonctionne pas, je dois sûrement oublier quelque chose mais je ne sais plus où chercher! D'où ma venue sur ce forum.
Comme vous l'aurez sûrement compris je suis débutante et j'ai vraiment besoin de votre aide.
Merci par avance
Novis 5

NB:Si toutefois vous avez un code plus adapté, n'hésitez pas
Pour infos, le code inséré est:


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<meta content="This time we are going to learn to create another thumbnail effect with fading and transparent caption." name="description" /><script src="js/jquery-1.3.1.min.js"></script><script>
 
$(document).ready(function() {
 
//move the image in pixel
var move = -15;
 
//zoom percentage, 1.2 =120%
var zoom = 1.2;
 
//On mouse over those thumbnail
$('.item').hover(function() {
 
//Set the width and height according to the zoom percentage
width = $('.item').width() * zoom;
height = $('.item').height() * zoom;
 
//Move and zoom the image
$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
 
//Display the caption
$(this).find('div.caption').stop(false,true).fadeIn(200);
},
function() {
//Reset the image
$(this).find('img').stop(false,true).animate({'width':$('.item').width(), 'height':$('.item').height(), 'top':'0', 'left':'0'}, {duration:100});
 
//Hide the caption
$(this).find('div.caption').stop(false,true).fadeOut(200);
});
 
});
 
</script>
<style type="text/css">body {
font-family:arial;
}
 
.item {
width:250px;
height:250px;
border:4px solid #222;
margin:5px 5px 5px 0;
 
/* required to hide the image after resized */
overflow:hidden;
 
/* for child absolute position */
position:relative;
 
/* display div in line */
float:left;
}
 
.item .caption {
width:250px;
height:250px;
background:#000;
color:#fff;
font-weight:bold;
 
/* fix it at the bottom */
position:absolute;
left:0;
 
/* hide it by default */
display:none;
 
/* opacity setting */
filter:alpha(opacity=80); /* ie */
-moz-opacity:0.8; /* old mozilla browser like netscape */
-khtml-opacity: 0.8; /* for really really old safari */
opacity: 0.8; /* css standard, currently it works in most modern browsers like firefox, */
 
}
 
.item .caption a {
text-decoration:none;
color:#0cc7dd;
font-size:16px;
 
/* add spacing and make the whole row clickable*/
padding:5px;
display:block;
}
 
.item .caption p {
padding:5px;
margin:0;
font-size:10px;
}
 
.item img {
border:0;
 
/* allow javascript moves the img position*/
position:absolute;
}
 
.clear {
clear:both;
}
</style>
<div class="item"><a href="#"><img alt="Peintures" height="250" src="1.gif" style="width: 250px; display: block; height: 250px; top: 0px; left: 0px;" title="" width="250" /></a>
<div class="caption" style="display: none;"><a href="">Peintures</a>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="item"><a href="#"><img alt="Boutique en Ligne" height="250" src="2.gif" title="" width="250" /></a>
 
<div class="caption"><a href="">Boutique en Ligne</a>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="item"><a href="#"><img alt="Sculptures" height="250" src="3.gif" style="width: 250px; display: block; height: 250px; top: 0px; left: 0px;" title="" width="250" /></a>
 
<div class="caption" style="display: none;"><a href="">Sculptures</a>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="clear">&nbsp;</div>
 
<div class="item"><a href="#"><img alt="Expositions" height="125" src="4.gif" style="width: 250px; display: block; height: 250px; top: 0px; left: 0px;" title="" width="250" /></a>
 
<div class="caption" style="display: none;"><a href="">Expositions</a>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="item"><a href="#"><img alt="Défiscalisations" height="250" src="5.gif" title="" width="250" /></a>
 
<div class="caption"><a href="">D&eacute;fiscalisations</a>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="item"><a href="#"><img alt="Contact" height="250" src="6.gif" style="width: 250px; display: block; height: 250px; top: 0px; left: 0px;" title="" width="250" /></a>
 
<div class="caption" style="display: none;"><a href="">Contact</a>
 
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
</div>
</div>
 
<div class="clear">&nbsp;</div>
<!-- START: Ignore this, not required by this tutorial --><script type="text/javascript">
if (typeof jQuery === 'undefined') document.write('<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>');
var url = 'http://www.queness.com/post/844/create-a-thumbnail-with-fading-caption-using-jquery';
var title = 'Create A Thumbnail With Fading Caption Using jQuery';
var content = '<p>This time we are going to learn to create another thumbnail effect with fading and transparent caption.</p>';
</script><script type="text/javascript" src="http://www.queness.com/assets/js/demo.js"></script><!-- END -->