sync
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
div {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
background-color: black;
|
||||
border: 1px solid white;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Dummy Title</title>
|
||||
<link href="css/styles.css" type="text/css" rel="stylesheet">
|
||||
<script src="js/index.js" defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
for ($i = 0; $i < 100; $i++)
|
||||
echo '<div></div>';
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
document.querySelectorAll('div').forEach((d) => {
|
||||
d.style.backgroundColor = 'black';
|
||||
d.addEventListener('click', populate);
|
||||
})
|
||||
|
||||
function populate() {
|
||||
if (this.style.backgroundColor === 'black') {
|
||||
this.style.backgroundColor = 'red';
|
||||
this.style.borderRadius = '50%';
|
||||
} else {
|
||||
this.style.backgroundColor = 'black';
|
||||
this.style.borderRadius = '0%';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user