
El script no se ejecuta
Publicado por JetLagFox (8 intervenciones) el 04/11/2016 11:10:52
Buenas,
Tengo creadas en un fichero "main.js" una función para poder desplazar el menú en versión móvil de izquierda a derecha (para que aparezca/desaparezca).
el código CSS:
Y el código HTML:
Muchas gracias!
Tengo creadas en un fichero "main.js" una función para poder desplazar el menú en versión móvil de izquierda a derecha (para que aparezca/desaparezca).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$(document).ready(main);
var contador = 1;
function main () {
$('.boton_menu').click(function(){
if (contador == 1) {
$('.menu').animate({
left: '0';
});
contador = 0;
} else {
contador = 1;
$('.menu').animate({
left: '-100%';
});
}
});
}
el código CSS:
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
@media screen and (max-width: 760px) {
header {
position: relative;
}
.menu {
position: fixed;
top: 50px;
right: 100%;
background: rgba(0,0,0,.8);
height: 100vh;
width: 90%;
}
.menu ul {
display: block;
}
.menu ul form {
display: none;
}
.boton_menu .fa-bars {
top: 16px;
color: white;
transform: scale(2);
display: block;
cursor: pointer;
position: absolute;
right: 15px;
}
.menu .submenu:hover ul {
display: none;
}
}
Y el código 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Menu</title>
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="css/font-awesome.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<link rel="stylesheet" href="css/estilos.css">
<script scr="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script src="main.js"></script>
</head>
<body>
<header>
<div class="contenedor_header">
<a href="index.php"><img src="imagenes/logo.png" alt="" /></a>
<div class="boton_menu">
<input type="checkbox" class="boton" id="boton">
<label class="fa fa-bars" for="boton"></label>
</div>
<div class="menu">
<ul>
<form class="busqueda" action="busqueda.php" method="get">
<input type="text" name="busqueda" placeholder="Buscar un juego...">
<button type="submit" name="button" class="fa fa-search"></button>
</form>
<li><a href="index.php">Home</a></li>
<li class="submenu"><a href="#">Juegos</a>
<ul>
<li><a href="listado_precios.php">Xbox One</a></li>
<li><a href="xbox360.php">Xbox 360</a></li>
<li><a href="retro.php">Retrocompatibles</a></li>
<li><a href="#">Games With Gold</a></li>
<li><a href="DWG.php">Deals With Gold</a></li>
</ul>
</li>
<li><a href="#">Contacto</a></li>
</ul>
</div>
</div>
</header>
Muchas gracias!
Valora esta pregunta


0