Skip to content
Snippets Groups Projects
Commit f0d3d2d3 authored by HerrWaechter's avatar HerrWaechter
Browse files

added box click

parent f142e866
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Course Website</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<nav class="navbar">
<div class="logo">
<a href="Homepage.html">LOGO</a>
</div>
<div class="nav-dots">
<h1>HOME</h1>
</div>
<a href="#" class="account-btn">Account</a>
</nav>
</body>
</html>
\ No newline at end of file
......@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Homepage</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="script.js" defer></script>
</head>
<body>
<nav class="navbar">
......@@ -18,11 +19,11 @@
</nav>
<main class="main-content">
<div class="left-column">
<div class="box">
<a href="Add-course.html">Add Course</a>
<div class="box" data-href="Add-course.html">
Add Course
</div>
<div class="box">
<a href="Cosmetic-shop.html">Cosmetic Shop</a>
<div class="box" data-href="Cosmetic-shop.html">
Cosmetic Shop
</div>
</div>
......@@ -38,4 +39,5 @@
</div>
</main>
</body>
</html>
\ No newline at end of file
const boxes = document.querySelectorAll('.box');
boxes.forEach((box) => {
box.addEventListener('click', function(e) {
alert('will redirect to:' + e.target.getAttribute('data-href'));
window.location.href = e.target.getAttribute('data-href');
});
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment