Skip to content

Commit 2c1abd0

Browse files
committed
Adicionada função que atualiza marcadores
1 parent f801e23 commit 2c1abd0

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

css/layout.css

+3
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,7 @@ section div{
9494
}
9595
.d-flex > *{
9696
width: 100%;
97+
}
98+
.livro-marcos > * {
99+
cursor: pointer;
97100
}

index.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
99
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1010
<link rel="stylesheet" href="css/layout.css">
11+
<script src="js/updateMark.js" defer></script>
1112
<script src="js/book.js" defer></script>
1213
</head>
1314
<body>
@@ -64,15 +65,15 @@ <h1>Books</h1>
6465
</p>
6566
</div>
6667
<div class="livro-marcos">
67-
<div>
68+
<div onclick="updateMark(this)">
6869
<span class="material-icons">
6970
book
7071
</span>
7172
<span class="round">
7273
12
7374
</span>
7475
</div>
75-
<div>
76+
<div onclick="updateMark(this)">
7677
<span class="material-icons">
7778
favorite
7879
</span>

js/updateMark.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
function updateMark(marcador){
3+
let campo = marcador.querySelector(".round");
4+
let valor = parseInt(campo.innerHTML);
5+
campo.innerHTML = ++valor;
6+
}

0 commit comments

Comments
 (0)