sync
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
div {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
button {
|
||||
float: right;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<!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>
|
||||
<button>Button</button>
|
||||
<div></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
const div = document.querySelector('div');
|
||||
const button = document.querySelector('button')
|
||||
|
||||
let times = 1;
|
||||
button.addEventListener('click', (e) => {
|
||||
let px = 300 * times;
|
||||
times++;
|
||||
div.style.top = px + 'px';
|
||||
});
|
||||
Reference in New Issue
Block a user