forked from Enricozon-Team/enricozon2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmobile.html
119 lines (112 loc) · 3.08 KB
/
mobile.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Responsive Grid</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #202020;
text-align: center;
overflow-x: hidden;
}
.search-container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30px;
}
#search {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
width: 250px;
font-size: 16px;
}
#search-button {
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
margin-left: 10px;
}
#search-button:hover {
background-color: #0056b3;
}
.container {
display: flex;
flex-direction: row;
justify-content: center;
padding: 15px;
gap: 15px;
}
.item {
flex: 1 1 calc(20% - 20px);
box-sizing: border-box;
text-align: center;
}
.item img {
width: auto;
height: auto;
}
.description {
color: #fff;
margin-top: 10px;
font-size: 16px;
}
</style>
</head>
<body>
<div class="search-container">
<input
type="text"
id="search"
placeholder="Cerca un prodotto..."
oninput="filterProducts()"
/>
<button type="submit" id="search-button">Cerca</button>
</div>
<div class="container">
<div class="item">
<img src="immagini/mandarino.jpg" alt="Image 1" />
<div class="description">Mandarino Fresco Km 0<br />€104</div>
</div>
<div class="item">
<img src="immagini/salvini.jpg" alt="Image 2" />
<div class="description">Matteo Salvini<br />€69</div>
</div>
</div>
<div class="container">
<div class="item">
<img src="immagini/mandarino.jpg" alt="Image 1" />
<div class="description">Mandarino Fresco Km 0<br />€104</div>
</div>
<div class="item">
<img src="immagini/salvini.jpg" alt="Image 2" />
<div class="description">Matteo Salvini<br />€69</div>
</div>
</div>
</body>
<script>
function filterProducts() {
var input, filter, container, images, description, i, txtValue;
input = document.getElementById("search");
filter = input.value.toUpperCase();
container = document.getElementsByClassName("container")[0];
images = container.getElementsByClassName("item");
for (i = 0; i < images.length; i++) {
description = images[i].getElementsByClassName("text")[0];
txtValue = description.textContent || description.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
images[i].style.display = "";
} else {
images[i].style.display = "none";
}
}
}
</script>
</html>