-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
html { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
background-image: url('grass.jpg'); | ||
} | ||
|
||
h1 { | ||
font-size: 40px; | ||
font-weight: 600; | ||
color: #ffffff; | ||
text-shadow: 2px 2px 3px #001a00; | ||
} | ||
|
||
p { | ||
color: #ffffff; | ||
font-weight: 600; | ||
} | ||
|
||
div { | ||
width: 50%; | ||
padding: 100px; | ||
border-radius: 50%; | ||
margin: 0 auto; | ||
} | ||
|
||
.one { | ||
background: #315082; | ||
} | ||
|
||
.two { | ||
background: #4a87bf; | ||
} | ||
|
||
.three { | ||
background: #6bb4d0; | ||
} | ||
|
||
.water { | ||
background-image: url('Ujeo.gif'); | ||
background-position: center; | ||
background-size: cover; | ||
display: block; | ||
} | ||
|
||
.refresh { | ||
background: #ffffff; | ||
font-size: 18px; | ||
font-weight: 400; | ||
color: #003366; | ||
border: 2px solid #003366; | ||
padding: 6px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | ||
<title>JS Events</title> | ||
|
||
<link href="css/style.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
<!--[if lt IE 9]> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html5shiv.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dest/respond.min.js"></script> | ||
<![endif]--> | ||
</head> | ||
<body> | ||
<h1>Event Bubbling</h1> | ||
<p>Just click on an any one of water rounds to see an bubbling effect</p> | ||
|
||
<button class = "refresh">Refresh Button</button> | ||
<div class = "one"> | ||
<div class = "two"> | ||
<div class = "three"></div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
const divs = document.querySelectorAll('div'); | ||
function logText(e) { | ||
console.log(this.classList.value); | ||
this.classList.add('water'); | ||
let audio = new Audio(); | ||
audio.src = 'water.wav'; | ||
audio.autoplay = true; | ||
|
||
e.stopPropagation(); | ||
}; | ||
|
||
divs.forEach(div => div.addEventListener('click', logText)); | ||
|
||
const refreshButton = document.querySelector('.refresh'); | ||
|
||
const refreshPage = () => { | ||
location.reload(); | ||
console.log('click'); | ||
}; | ||
|
||
refreshButton.addEventListener('click', refreshPage, {once: true}); | ||
|
||
</script> | ||
</body> | ||
</html> |
Binary file not shown.