Bonjour,
J'ai actuellement un problème avec un script que j'ai créé.
Celui-ci est censé afficher tous les résultats à partir d'une base de données avec les images des contacts (dans ce cas).
Sur chaque image, lorsqu'on passe son curseur dessu il est censé afficher une petite popup avec l'image agrandie, le seul hic c'est qu'il faut que cette popup soit alignée à côté de chaque image correspondante.
Alors j'ai tenté de faire mon script comme ceci mais lorsqu'on pointe son curseur sur les images suivantes, l'image agrandie reste sur le premier contact du haut..
Comment faire ?
Voici mon script:
Et voici mon css:
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231 <?php include'functions.php'; $db = mysql_connect("$db_host", "$db_user", "$db_pass") or die("<br><br><br><br><br><br><font color='red'><b>Une erreur est survenue sur le site, veuillez réessayer plus tard.<br>Le service informatique.</b></font> <font color='#FFFFFF'>Erreur: ".mysql_error()."</font>"); mysql_select_db("$db_name",$db) or die("<br><br><br><br><br><br><font color='red'><b>Une erreur est survenue sur le site, veuillez réessayer plus tard.<br>Le service informatique.</b></font> <font color='#FFFFFF'>Erreur: ".mysql_error()."</font>"); $sql = "SELECT * FROM contacts WHERE company_id='".$_GET['id']."' AND status='true' ORDER BY name"; $req = mysql_query($sql) or die("<br><br><br><br><br><br><font color='red'><b>Une erreur est survenue sur le site, veuillez réessayer plus tard.<br>Le service informatique.</b></font> <font color='#FFFFFF'>Erreur: ".$sql."</font>"); ?> <br /> <br /> <br /> <br /> <br /> <br /> <?php $nb = mysql_num_rows($req); if($nb<1) { echo'<script language="JavaScript">'; echo'alert(\'Aucun contact disponible pour cette société\');'; echo'document.location.href="index.php";'; echo'</script>'; } else { $a=0; $b=0; $i=1; echo'<table border="0" cellspacing="0" cellpadding="0" width="100%">'; echo'<tr>'; echo'<td>'; echo'<img src="'.$image_path.'/blank.gif" class="space_result_contacts">'; echo'</td>'; echo'<td>'; echo'<div class="result_contacts">'; echo'<img src="'.$image_path.'/blank.gif" class="top_bottom_result_contacts">'; echo'<table border="0" cellspacing="0" cellpadding="0" width="100%">'; echo'<tr>'; while($var=mysql_fetch_array($req)){ echo'<td>'; if(isset($hr_display)&&$hr_display=='true') echo'<hr id="hr_result_contacts">'; echo'<div class="contacts">'; echo'<table border="0" cellspacing="5" cellpadding="5" width="100%" onmouseover="this.className=\'contacts_onmouseover\'" onmouseout="this.className=\'companies\'">'; echo'<tr>'; echo'<td width="10%" valign="top">'; if(isset($var['picture'])&&!empty($var['picture'])) { echo'<div onmouseover="document.getElementById(\'picture_popup\').className=\'picture_contacts_*full\'" onmouseout="document.getElementById(\'picture_popup\').className=\'picture_contacts_f*ull_hover\'">'; echo'<img src="'.$image_path.'/contacts/'.$var['picture'].'" class="picture_contacts">'; echo'</div>'; if(isset($top_add)&&!empty($top_add)) { $top_view=300+$top_add; } else { $top_view='300'; } echo'<div class="picture_contacts_full_hover" id="picture_popup" style="top: '.$top_view.';">'; echo'<img src="'.$image_path.'/contacts/'.$var['picture'].'">'; echo'</div>'; } else { echo'<img src="'.$image_path.'/contacts/contact_blank.jpg" class="picture_contacts">'; } echo'</td>'; echo'<td width="90%" align="left" valign="top">'; echo'<table border="0" cellspacing="0" cellpadding="0" width="100%">'; echo'<tr>'; echo'<td align="left" width="10%">'; echo'<img src="'.$image_path.'/blank.gif" class="result_contacts">'; echo'<br>'; if(isset($var['country'])&&!empty($var['country'])) { country($var['country'],$image_path); } echo' '; if(isset($var['surname'])&&!empty($var['surname'])) { echo'<b>'; echo $var['surname']; echo'</b>'; } echo' '; if(isset($var['name'])&&!empty($var['name'])) { echo'<b>'; echo $var['name']; echo'</b>'; } echo'</td>'; $sql_services = "SELECT * FROM services WHERE company_id='".$var['company_id']."' AND id='".$var['service_id']."' AND status='true'"; $req_services = mysql_query($sql_services) or die("<br><br><br><br><br><br><font color='red'><b>Une erreur est survenue sur le site, veuillez réessayer plus tard.<br>Le service informatique.</b></font> <font color='#FFFFFF'>Erreur: ".$sql_services."</font>"); $var_services=mysql_fetch_array($req_services); echo'<td align="left" width="90%">'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_services.gif" border="0" title="Département dans la société"> '; if(isset($var_services['id'])&&!empty($var_services['id'])&&$var['service_id']>0) { echo $var_services['name']; } else { echo'Service inconnu'; } echo'</div>'; echo'</td>'; echo'</tr>'; echo'<tr>'; echo'<td>'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_mail.gif" border="0" title="Adresse mail"> '; if(isset($var['mail'])&&!empty($var['mail'])) { echo'<a href="mailto:'.$var['mail'].'">'.$var['mail'].'</a>'; } else { echo'Aucune adresse email'; } echo'</div'; echo'</td>'; echo'<td>'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_function.gif" border="0" title="Fonction dans la société"> '; if(isset($var['function'])&&!empty($var['function'])) { echo $var['function']; } else { echo'Fonction inconnue'; } echo'</div>'; echo'</td>'; echo'</tr>'; echo'<tr>'; echo'<td>'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_gsm.gif" border="0" title="Numéro de gsm"> '; if(isset($var['gsm'])&&!empty($var['gsm'])) { echo $var['gsm']; } else { echo'Aucun numéro de gsm'; } echo'</div>'; echo'</td>'; echo'<td>'; if(isset($var['others'])&&!empty($var['others'])) { echo'<b>Autres informations:</b>'; } echo'</td>'; echo'</tr>'; echo'<tr>'; echo'<td valign="top">'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_phone.gif" border="0" title="Numéro de téléphone (+ tel interne)"> '; if(isset($var['phone_ext'])&&!empty($var['phone_ext'])) { echo $var['phone_ext']; if(isset($var['phone_int'])&&!empty($var['phone_int'])) { echo' '; echo'('; echo $var['phone_int']; echo')'; } } else { if(isset($var['phone_int'])&&!empty($var['phone_int'])) { echo $var['phone_int']; } else { echo'Aucun numéro de téléphone'; } } echo'</div>'; echo'<div class="space_icon">'; echo'<img src="'.$image_path.'/icon_fax.gif" border="0" title="Numéro de fax"> '; if(isset($var['fax'])&&!empty($var['fax'])) { echo $var['fax']; } else { echo'Aucun numéro de fax'; } echo'</div>'; echo'</td>'; echo'<td valign="top">'; if(isset($var['others'])&&!empty($var['others'])) { echo $var['others']; } echo'</td>'; echo'</tr>'; echo'</table>'; echo'</td>'; echo'</tr>'; echo'</table>'; echo'</div>'; echo'</td>'; $a++; if($a==$contacts_columns){ $a=0; $b++; echo '</tr>';; if($b<$contacts_columns) echo '<tr>'; $hr_display='true'; $top_add='50'; } } echo'</table>'; echo'<img src="'.$image_path.'/blank.gif" class="top_bottom_result_contacts">'; echo'</div>'; echo'</td>'; echo'</tr>'; echo'</table>'; echo'<br>'; echo'<table border="0" cellspacing="0" cellpadding="0" width="100%">'; echo'<tr>'; echo'<td>'; echo'<img src="'.$image_path.'/blank.gif" class="space_result_contacts">'; echo'</td>'; echo'<td>'; echo'<div class="result_contacts" align="center">'; echo'Toute demande d\'ajout ou de modification de contact doit se faire par mail à: <a href="mailto:"></a>'; echo'</div>'; echo'</td>'; echo'</tr>'; echo'</table>'; } mysql_close(); ?>
Code CSS : 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 /* Contacts */ img.picture_contacts { width: 133; height: 100; border: 0; } .picture_contacts_full { position:absolute; visibility: visible; left: 300; width: 400; height: 300; border: 1px solid black; z-index: 0; } .picture_contacts_full_hover { visibility: hidden; width: 0; height: 0; } img.top_bottom_result_contacts { border: 0; width: 1; height: 5; } img.space_result_contacts { border: 0; width: 20; height: 1; } img.result_contacts { border: 0; width: 250; height: 1; } #hr_result_contacts { color: #cecece; background-color: #cecece; height: 1px; border: 0; } .result_contacts { border-style: solid; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-right-width:1px; border-color: #cecece; width: 600; } .contacts { background-color: #FFFFFF; width: 600; } .contacts_onmouseover { background-color: #e0ecf4; width: 600; } /**/ .space_icon { padding-top: 1; }
Je vous remercie d'avance.
Partager