Skip to content

Commit

Permalink
add close button modal mobile screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ptduy14 committed May 16, 2024
1 parent 5c2c115 commit 88203de
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
10 changes: 9 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var toggleButton = document.querySelector('.toggle');
var modal = document.querySelector('.modal')
var layer = document.querySelector('.layer')
var closeModal = document.querySelector('.close_modal');

toggleButton.addEventListener('click', () => {
modal.classList.add("modal-active")
Expand All @@ -10,4 +11,11 @@ toggleButton.addEventListener('click', () => {
layer.addEventListener('click', () => {
modal.classList.remove("modal-active")
layer.classList.remove("layer-active")
})
})

if (closeModal) {
closeModal.addEventListener('click', () => {
modal.classList.remove("modal-active")
layer.classList.remove("layer-active")
})
}
2 changes: 1 addition & 1 deletion pages/ex-four.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="toggle">MORE</div>
<div class="layer"></div>
<div class="modal">
<div class="nav"></div>
<div class="close_modal">X</div>
<div class="content">
<p>
Thiết kế polygon hình tứ giác theo thao tác click chuột của người
Expand Down
2 changes: 1 addition & 1 deletion pages/ex-one.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<body>
<div class="toggle">MORE</div>
<div class="modal">
<div class="nav"></div>
<div class="close_modal">X</div>
<div class="content">
<p>
Chấm trên bảng đồ chọn Marker và Marker di chuyển theo thao tác của
Expand Down
2 changes: 1 addition & 1 deletion pages/ex-three.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div class="toggle">MORE</div>
<div class="modal">
<div class="nav"></div>
<div class="close_modal">X</div>
<div class="content">
<p>
Vẽ Polyline bằng thao tác click chuột trên bản đồ. Trong đó: </br>
Expand Down
2 changes: 1 addition & 1 deletion pages/ex-two.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<body>
<div class="toggle">MORE</div>
<div class="modal">
<div class="nav"></div>
<div class="close_modal">X</div>
<div class="content">
<p>
Tính và hiển thị khoảng cách từ hai điểm (dùng Popup hiển thị tại vị
Expand Down
21 changes: 21 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,25 @@ footer {

.modal > a:nth-last-child(1) {
margin-left: 10px;
}

.close_modal {
display: none;
}

@media (max-width: 739px) {
.modal {
width: 100%;
}

.close_modal {
transform: translateX(-8px);
transform: translateY(-6px);
display: inline-block;
margin-bottom: 20px;
padding: 10px 15px;
background-color: white;
color: black;
border-radius: 50px;
}
}

0 comments on commit 88203de

Please sign in to comment.