Bonjour à toutes et à tous,
Je viens vous demander un coup de main car j'ai un menu responsive en css qui affiche un burger quand on est en dessous de 768px qui fonctionne parfaitement sauf sur iphone.
Sur iphone le menu ne s'affiche pas quand on clique sur le burger mais je vois pas pourquoi.
Si quelqu'un pouvais éclairer ma lanterne ça serait cool.
Voici le css du menu
Voici le
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271 nav { position: relative; } header.light nav { background-color:rgba(255,255,255,10); } ul.main-nav { list-style-type: none; padding: 0px; font-size: 0px; max-width: 1000px; margin: 0 auto; } ul.main-nav > li { display: inline-block; padding: 0; min-width:50px; } ul.main-nav > li > a { display: block; padding: 20px 30px; position: relative; color: #000; font-size: 16px; font-variant-caps: all-small-caps; box-sizing: border-box; text-decoration:none; text-align: center; padding: 0; } .logo_menu { display: inline-block; } ul.main-nav > li:hover > a { color: #333; font-weight:700; } ul.main-nav > li ul.sub-menu-lists { margin: 0px; padding: 0px; list-style-type : none; display:block; } ul.main-nav > li ul.sub-menu-lists > li { padding: 2px 0; } ul.main-nav > li ul.sub-menu-lists > li > a { font-size: 14px; } .ic { position: fixed; cursor: pointer; display: inline-block; right: 25px; width: 32px; height: 24px; text-align: center; top:0px; outline: none; } .ic.close { opacity: 0; font-size: 0px; font-weight: 300; color: #fff; top:8px; height:40px; display: block; outline: none; } /* Menu Icons for Devices*/ .ic.menu { top:25px; z-index : 20; } .ic.menu .line { height: 4px; width: 100%; display: block; margin-bottom: 6px; } .ic.menu .line-last-child { margin-bottom: 0px; } .sub-menu-head { margin: 10px 0; } .banners-area { margin-top: 20px; padding-top: 15px; } @media only screen and (max-width:768px) { .sub-menu-head { color:orange; } .ic.menu { display: block; } header.light .ic.menu .line { background-color: #000; } .ic.menu .line { -webkit-transition: all 0.4s ease 0s; -o-transition: all 0.4s ease 0s; transition: all 0.4s ease 0s; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); -webkit-transform-origin: center center; -ms-transform-origin: center center; transform-origin: center center; } .ic.menu:focus .line { background-color: #fff !important; } .ic.menu:focus .line:nth-child(1) { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .ic.menu:focus .line:nth-child(2) { -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); transform: rotate(-45deg); margin-top: -10px; } .ic.menu:focus .line:nth-child(3) { transform: translateY(15px); opacity: 0; } .ic.menu:focus{ outline: none; } .ic.menu:focus ~ .ic.close { opacity: 1; z-index : 21; outline: none; } .ic.menu:hover, .ic.menu:focus { opacity: 1; } nav { background-color: transparent; } /* Main Menu for Handheld Devices */ ul.main-nav { z-index:2; padding: 50px 0; position: fixed; right: 0px; top: 0px; width: 0px; background-color:rgba(0,0,0,1); height: 100%; overflow: auto; /*CSS animation applied : Slide from Right*/ -webkit-transition-property: background, width; -moz-transition-property: background, width; -o-transition-property: background, width; transition-property: background, width; -webkit-transition-duration: 0.6s; -moz-transition-duration: 0.6s; -o-transition-duration: 0.6s; transition-duration: 0.6s; } .ic.menu:focus ~ .main-nav { width: 300px; background-color:rgba(0,0,0,1); } ul.main-nav > * { -webkit-transition-property: opacity; -moz-transition-property: opacity; -o-transition-property: opacity; transition-property: opacity; -webkit-transition-duration: 0.4s; -moz-transition-duration: 0.4s; -o-transition-duration: 0.4s; transition-duration: 0.4s; opacity: 0; } .ic.menu:focus ~ .main-nav > * {opacity: 1;} ul.main-nav > li > a:after {display: none;} ul.main-nav > li:first-child { border-radius: 0px; } ul.main-nav > li { display: block; border-bottom: 1px solid #444; } ul.main-nav > li > a {color: #fff; font-weight: 600; } ul.main-nav > li ul.sub-menu-lists > li a { color: #eee; font-size: 14px; } .sub-menu-head { font-size: 16px;} ul.main-nav > li:hover { background-color: transparent; } ul.main-nav > li:hover > a {color: #f0f0f0; text-decoration: none; font-weight: 600;} .ic.menu:focus ~ ul.main-nav > li > div.sub-menu-block { border-left: 0px solid #ccc; border-right: 0px solid #ccc; border-bottom: 0px solid #ccc; position: relative; visibility: visible; opacity: 1.0; } .sub-menu-block { padding: 0 30px; } .banners-area { padding-bottom: 0px; } .banners-area div { margin-bottom: 15px; } .banners-area { border-top: 1px solid #444; } } @media only screen and (min-width:769px) { .ic.menu { display: none; } /* Main Menu for Desktop Devices */ ul.main-nav { display: block; position: relative; } .sub-menu-block { padding: 15px; } /* Sub Menu */ ul.main-nav > li > div.sub-menu-block { visibility: hidden; background-color: #f9f9f9; position: absolute; margin-top: 0px; width: 100%; color: #333; left: 0; box-sizing: border-box; z-index : 3; font-size: 16px; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; opacity: 0; /*CSS animation applied for sub menu : Slide from Top */ -webkit-transition: all 0.4s ease 0s; -o-transition: all 0.4s ease 0s; transition: all 0.4s ease 0s; -webkit-transform: rotateX(90deg); -moz-transform: rotateX(90deg); -ms-transform: rotateX(90deg); transform: rotateX(90deg); -webkit-transform-origin: top center; -ms-transform-origin: top center; transform-origin: top center; } ul.main-nav > li:hover > div.sub-menu-block{ background-color: #f9f9f9; visibility: visible; opacity: 1; -webkit-transform: rotateX(0deg); -moz-transform: rotateX(0deg); -ms-transform: rotateX(0deg); transform: rotateX(0deg); } ul.main-nav > li > div.sub-menu-block > * { -webkit-transition-property: opacity; -moz-transition-property: opacity; -o-transition-property: opacity; transition-property: opacity; -webkit-transition-duration: 0.4s; -moz-transition-duration: 0.4s; -o-transition-duration: 0.4s; transition-duration: 0.4s; opacity: 0; } ul.main-nav > li:hover > div.sub-menu-block > * { opacity: 1; } .sub-menu-head { font-size: 20px;} header.light ul.main-nav li a:after { content: ''; display: block; margin: auto; margin-top:20px; height:2px; width: 0; background: transparent; transition: width .3s ease, background-color .3s ease; } header.light ul.main-nav li a:hover:after { width:100%; background: #444; } .sub-menu-block .row_menu ul.sub-menu-lists li a { margin:0 auto; margin-top:0;text-decoration:none; color:#444;} .sub-menu-block .row_menu ul.sub-menu-lists li a:after { margin-top:0; text-decoration:none;height:0;} .sub-menu-block .row_menu ul.sub-menu-lists li a:hover:after { margin:0 auto; margin-top:0;text-decoration:none;width: 0; background:transparent;} /* Drop Down/Up Arrow for Mega Menu */ ul.main-nav > li > a.mega-menu > span { display: block; vertical-align: middle; } ul.main-nav > li > a.mega-menu > span:after { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000; content: ''; background-color: transparent; display: inline-block; margin-left: 10px; vertical-align: middle; } ul.main-nav > li:hover > a.mega-menu span:after{ border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 0px solid transparent; border-bottom: 5px solid #666; } .banners-area { border-top: 1px solid #ccc; } }
Code PHP : 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 <?php $req_menu_hor = $bdd->prepare("SELECT id, nom_onglet, lien_onglet FROM menu WHERE auth_view <= :auth ORDER BY ordre_aff ASC"); $req_menu_hor->bindValue('auth', $level, PDO::PARAM_INT); try { $req_menu_hor->execute(); } catch (PDOException $e) { echo 'Error : ' . $e->getMessage(); die(); } echo'<div id="header"> <header class="light"> <nav role="navigation"> <a href="javascript:void(0);" class="ic menu"> <span class="line"></span> <span class="line"></span> <span class="line"></span> </a> <a href="javascript:void(0);" class="ic close"></a> <span class="logo_menu"><a href="'.VARIABLE[0].'/" title="Accueil de votre opticien à Marseille"><img src="'.VARIABLE[0].'/images/logo-opticien-marseille-le-lunetier.png" alt="Logo de votre opticien Le Lunetier à Marseille"/></a></span> <ul class="main-nav" id="myTopnav">'; while ($res_menu_hor = $req_menu_hor->fetch()) { echo'<li class="top-level-link"><a '; $recherche_rub = $bdd->prepare("SELECT rubrique_id, nom_rubrique, num_id_menu FROM rubrique_menu WHERE num_id_menu = :id_menu AND auth_view_rubrique <= :auth_rub ORDER BY ordre_rubrique ASC"); $recherche_rub->bindValue('id_menu', $res_menu_hor['id'], PDO::PARAM_INT); $recherche_rub->bindValue('auth_rub', $level, PDO::PARAM_INT); try { $recherche_rub->execute(); $total_rub = $recherche_rub->rowCount(); } catch (PDOException $e) { echo 'Error : ' . $e->getMessage(); die(); } if ($total_rub > 0) { echo ' class="mega-menu"'; } echo' href="'.VARIABLE[0].'/'.$res_menu_hor['lien_onglet'].'.html" title="page '.$res_menu_hor['nom_onglet'].' de votre opticien Le Lunetier à Marseille"><span>'.$res_menu_hor['nom_onglet'].'</span></a>'; if ($total_rub > 0) { echo'<div class="sub-menu-block">'; while ($res_rub = $recherche_rub->fetch()) { echo'<div class="rub_menu sub-menu-head">'.$res_rub['nom_rubrique'].'</div>'; $rech_sous_ong = $bdd->prepare("SELECT nom_s_ong, lien_s_ong FROM sous_menu WHERE cor_id_rub = :num_id_rub AND auth_view_s <= :auth_s_ong ORDER BY ordre_s_ong ASC"); $rech_sous_ong->bindValue('num_id_rub', $res_rub['rubrique_id'], PDO::PARAM_INT); $rech_sous_ong->bindValue('auth_s_ong', $level, PDO::PARAM_INT); try { $rech_sous_ong->execute(); $total_s_ong = $rech_sous_ong->rowCount(); } catch (PDOException $e) { echo 'Error : ' . $e->getMessage(); die(); } if ($total_s_ong > 0) { echo'<div class="row_menu"> <div class="col-md-4 col-lg-4 col-sm-4">'; echo '<ul class="sub-menu-lists">'; while ($res_sous_ong = $rech_sous_ong->fetch()) { echo'<li><a href="'.VARIABLE[0].'/'.$res_sous_ong['lien_s_ong'].'.html" title="page '.$res_sous_ong['nom_s_ong'].' de votre opticien Le Lunetier à Marseille">'.$res_sous_ong['nom_s_ong'].'</a></li>'; } echo '</ul>'; echo'</div> </div>'; } $rech_sous_ong->closeCursor(); $rech_img = $bdd->prepare("SELECT lien_img, lien_dest FROM image_menu WHERE id_rub_cor = :num_rub AND auth_view_img <= :auth_sous_ong ORDER BY ordre_aff_img ASC"); $rech_img->bindValue('num_rub', $res_rub['rubrique_id'], PDO::PARAM_INT); $rech_img->bindValue('auth_sous_ong', $level, PDO::PARAM_INT); try { $rech_img->execute(); $total_img = $rech_img->rowCount(); } catch (PDOException $e) { echo 'Error : ' . $e->getMessage(); die(); } if ($total_img > 0) { echo'<div class="row_menu banners-area">'; while ($res_img = $rech_img->fetch()) { echo'<div class="col-md-6 col-lg-6 col-sm-6"><a href="'.VARIABLE[0].'/'.$res_img['lien_dest'].'.html" title="Nouveauté de votre opticien Le Lunetier à Marseille"><img alt="Nouveauté de votre opticien Le Lunetier à Marseille" src="'.$res_img['lien_img'].'"></a></div>'; } echo'</div>'; } $rech_img->closeCursor(); } echo'</div>'; } $recherche_rub->closeCursor(); echo'</li>'; } echo'</ul> </nav> </header></div>'; $req_menu_hor->closeCursor(); ?>
Merci d'avance
Partager