HTML - menu con diseno responsive no funciona

 
Vista:

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 18/02/2020 01:21:17
Estoy desarrollando un menu responsive, en el tutorial trabaja excelente pero en mi localhost no funciona,

este es el CODIGO HTML:

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
<meta charset="UTF-8">
<title>Menu</title><meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 
  <link rel="stylesheet" href="estilos.css">
  <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
  <script src="main.js"></script>
</head>
<body>
<div class="wrapper">
  <h1>Menu</h1>
  <a class="menu-btn" onclick="toggleMenu()"></a>
  <section class="one" onclick="goToPage(0)">
    <h1>Servicios</h1>
  </section>
  <section class="two" onclick="goToPage(1)">
    <h1>Citas</h1>
  </section>
  <section class="three" onclick="goToPage(2)">
    <h1>Mensajes</h1>
  </section>
  <section class="four" onclick="goToPage(3)">
    <h1>Settings</h1>
  </section>
</div>
</body>

************************************************************************************
LOS ESTILOS
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
@import url(https://fonts.googleapis.com/css?family=Lato);
 
$color1: #f75b5b;
$color2: #c84051;
$color3: #4f3462;
$color4: #794d9a;
 
* {
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}
 
html {
  font-size: 62.5%;
  font-family: 'Lato', sans-serif;
}
 
body {
 background: #1f252d;
}
 
.wrapper {
  height: 480px;
  width: 320px;
  background: #2e394b;
  overflow: hidden;
  position: relative;
  margin: 20px auto 0;
}
 
.menu-btn {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  height: 70px;
  width: 54px;
  cursor: pointer;
  background: url(https://iamturner.co.uk/codepen/menu-icon.png) no-repeat center;
  background-size: 44px;
 
  &:active {
    opacity: 0.2;
  }
 
}
 
section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px 8px 0 0;
  -webkit-transition: -webkit-transform 0.3s;
 
  &.one {
    background: $color1;
    -webkit-transition-delay: 0s;
  }
 
  &.two {
    background: $color2;
    -webkit-transition-delay: 0.05s;
  }
 
  &.three {
    background: $color3;
    -webkit-transition-delay: 0.1s;
  }
 
  &.four {
    background: $color4;
    -webkit-transition-delay: 0.15s;
  }
 
  &.after {
    -webkit-transform: translateY(100%);
  }
 
}
 
h1 {
  color: white;
  font-weight: 500;
  font-size: 2rem;
  text-align: center;
  margin: 0;
  line-height: 70px;
  -webkit-user-select: none;
}
 
.page-one {
  section {
    &.one { -webkit-transition-delay: 0s; }
    &.two { -webkit-transition-delay: 0.15s; }
    &.three { -webkit-transition-delay: 0.1s; }
    &.four { -webkit-transition-delay: 0.05s; }
  }
}
 
.page-two {
  section {
    &.one { -webkit-transition-delay: 0s; }
    &.two { -webkit-transition-delay: 0.05s; }
    &.three { -webkit-transition-delay: 0.1s; }
    &.four { -webkit-transition-delay: 0.05s; }
  }
}
 
.menu-open {
 
  section {
    cursor: pointer;
 
    &.one {
      -webkit-transform: translateY(70px);
      -webkit-transition-delay: 0.15s;
 
      &:active {
        background: lighten($color1, 3%);
      }
 
    }
 
    &.two {
      -webkit-transform: translateY(140px);
      -webkit-transition-delay: 0.1s;
 
      &:active {
        background: lighten($color2, 3%);
      }
 
    }
 
    &.three {
      -webkit-transform: translateY(210px);
      -webkit-transition-delay: 0.05s;
 
      &:active {
        background: lighten($color3, 3%);
      }
 
    }
 
    &.four {
      -webkit-transform: translateY(280px);
      -webkit-transition-delay: 0s;
 
      &:active {
        background: lighten($color4, 3%);
      }
 
    }
 
  }
 
  &.page-one {
    section {
      &.one { -webkit-transition-delay: 0s; }
      &.two { -webkit-transition-delay: 0.05s; }
      &.three { -webkit-transition-delay: 0.1s; }
      &.four { -webkit-transition-delay: 0.15s; }
    }
  }
 
  &.page-two {
    section {
      &.one { -webkit-transition-delay: 0s; }
      &.two { -webkit-transition-delay: 0.05s; }
      &.three { -webkit-transition-delay: 0.1s; }
      &.four { -webkit-transition-delay: 0.15s; }
    }
  }
 
}


*****************************************************************
CODIGO JS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var pages = new Array('one', 'two', 'three', 'four');
 
function toggleMenu() {
 document.getElementsByClassName('wrapper')[0].classList.toggle('menu-open');
}
 
function goToPage(page) {
  var wrapper = document.getElementsByClassName('wrapper')[0];
  var sections = document.getElementsByTagName('section');
  for (i = 0; i < sections.length; i++) {
    sections[i].classList.remove('before','after');
    if (i > page) {
      sections[i].classList.add('after');
    }
  }
  wrapper.classList.remove('menu-open','page-one','page-two');
  wrapper.classList.add('page-' + pages[page]);
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 18/02/2020 01:45:39
quiero decir que Esos codigos los tome de este sitio: https://codepen.io/GrahamWilsdon/pen/OVoaNQ lo que no entiendo es porque el codigo HTML aparece incompleto

aparece asi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div class="wrapper">
  <h1>Menu</h1>
  <a class="menu-btn" onclick="toggleMenu()"></a>
  <section class="one" onclick="goToPage(0)">
    <h1>Profile</h1>
  </section>
  <section class="two" onclick="goToPage(1)">
    <h1>Friends</h1>
  </section>
  <section class="three" onclick="goToPage(2)">
    <h1>Messages</h1>
  </section>
  <section class="four" onclick="goToPage(3)">
    <h1>Settings</h1>
  </section>
</div>


pero no funciona como habia explicado.
yo le complete asi:
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Menu</title><meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
  <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="estilos.css">
  <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
  <script src="main.js"></script>
</head>
<body>
<div class="wrapper">
  <h1>Menu</h1>
  <a class="menu-btn" onclick="toggleMenu()"></a>
  <section class="one" onclick="goToPage(0)">
    <h1>Servicios</h1>
  </section>
  <section class="two" onclick="goToPage(1)">
    <h1>Citas</h1>
  </section>
  <section class="three" onclick="goToPage(2)">
    <h1>Mensajes</h1>
  </section>
  <section class="four" onclick="goToPage(3)">
    <h1>Settings</h1>
  </section>
</div>
</body>
</HTML>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 18/02/2020 15:09:14
Si alguien por favor pudiera atisbar algo a ver cual es el problema.
Es decir aparece sin el header; yo despues lo complete y aun asi no funciona.
El codigo aparece en el tutorial asi:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div class="wrapper">
  <h1>Menu</h1>
  <a class="menu-btn" onclick="toggleMenu()"></a>
  <section class="one" onclick="goToPage(0)">
    <h1>Servicios</h1>
  </section>
  <section class="two" onclick="goToPage(1)">
    <h1>Citas</h1>
  </section>
  <section class="three" onclick="goToPage(2)">
    <h1>Mensajes</h1>
  </section>
  <section class="four" onclick="goToPage(3)">
    <h1>Settings</h1>
  </section>
</div>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 19/02/2020 17:04:22
Podria alguien ayudar por favor , una idea nada mas.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 19/02/2020 21:23:54
Buenas tardes Ya resolvi el problema del menu responsive.

Gracias por permitirme entrar a este espacio.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de joel
Val: 1.453
Oro
Ha mantenido su posición en HTML (en relación al último mes)
Gráfica de HTML

menu con diseno responsive no funciona

Publicado por joel (460 intervenciones) el 20/02/2020 07:43:45
Hola Cosmito, nos puedes comentar cual fue la solución? o donde estaba el problema?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

menu con diseno responsive no funciona

Publicado por cosmito (16 intervenciones) el 25/02/2020 21:44:08
Bueno la verdad es que encontre otro codigo el cual funciono. Resulta que el codigo HTML anterior no tiene encabezado. Hice todos los intentos posibles sin resultados. Asi que no perdi mas tiempo en ello.
El codigo CSS tambien presenta fallas.
Si alguien si pudo resolverlo que comente como lo hizo. Gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar