-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·77 lines (63 loc) · 2.34 KB
/
index.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
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Segnacarte Scopa</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.6.4.min.js"
integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
<link rel="shortcut icon" href="https://icons.getbootstrap.com/assets/icons/diamond-half.svg" type="image/x-icon">
<style>
.segna-carte.carta-1 {
background: url('../img/01-bastoni.png') no-repeat;
}
.carta {
width: 120px;
border-radius: 10px;
}
body {
background-color: #54B9D1 !important;
}
@media (max-width: 767px) {
.carta {
width: 75px;
border-radius: 5px;
}
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center mt-2 text-light">Segnacarte Scopa</h1>
<div id="carte" class="d-flex justify-content-center">
</div>
</div>
<script>
$(document).ready(function () {
$.getJSON("data.php", function (data) {
var files = data;
var list = $('<div class="d-flex justify-content-center flex-wrap">');
$.each(files, function (index, value) {
list.append(card(value, index));
});
$("#carte").append(list);
});
});
function card(path, index) {
html = '<img id="carta-' + index + '" class="carta m-2" src="img/' + path + '" data-value="' + path + '" onclick="hideElementById(\'carta-' + index + '\')">';
return html;
}
function hideElementById(id) {
var card = document.getElementById(id);
if (card.src.includes('bg.jpg')) {
card.src = 'img/' + card.getAttribute("data-value");
} else {
card.src = 'img/bg.jpg';
}
}
</script>
</body>
</html>