Skip to content

Commit ed025c5

Browse files
committed
little functionality
1 parent c958d86 commit ed025c5

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/main/resources/views/books/books.html

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,38 @@ <h1>My Library &ndash; List of books</h1>
5050
</table>
5151

5252
<div id="rightSide" >
53-
5453
<h2 id="bookTitle">Title</h2>
5554
<h3 id="bookAuthor">Author</h3>
5655
<p id="bookDescription">Description</p>
56+
<img src="https://upload.wikimedia.org/wikipedia/en/a/a0/Harry_Potter_and_the_Prisoner_of_Azkaban.jpg" alt="book image" width="70%" height="70%">
5757
</div>
5858

5959
<script th:inline="javascript">
6060

6161
var isResized = false;
6262
var lastId;
6363
function showDetail(id, title, page, year, author) {
64-
65-
if(isResized && lastId === id){
64+
if(lastId) {
65+
document.getElementById(lastId).style.backgroundColor = "#FFFFFF";
66+
}
67+
if(isResized && lastId === id) {
6668
document.getElementById('booksTable').style.width = "100%";
6769
document.getElementById('rightSide').style.display = "none";
6870
} else {
69-
document.getElementById('booksTable').style.width = "50%";
71+
document.getElementById(id).style.backgroundColor = "#1979a9";
72+
document.getElementById('booksTable').style.width = "60%";
7073
document.getElementById('booksTable').style.float = "left";
71-
7274
document.getElementById('rightSide').style.float = "left";
73-
document.getElementById('rightSide').style.width = "40%";
75+
document.getElementById('rightSide').style.width = "35%";
7476
document.getElementById('rightSide').style.display = "block";
75-
document.getElementById('rightSide').style.margin= "1% 5% 1% 5%";
76-
77+
document.getElementById('rightSide').style.margin= "1% 2.5% 1% 2.5%";
7778
document.getElementById('bookTitle').innerHTML = title;
7879
document.getElementById('bookAuthor').innerHTML = author;
7980
document.getElementById('bookDescription').innerHTML = 'Year: ' + year + ', pages: ' + page;
8081
}
81-
82-
83-
8482
isResized = !isResized;
8583
lastId = id;
8684
}
87-
88-
8985
</script>
9086
</body>
9187
</html>

0 commit comments

Comments
 (0)