Commit 4eb60a22 authored by Tapio Mäntysalo's avatar Tapio Mäntysalo
Browse files

Added dropdown for choosing the task

parent 26f44dfb
......@@ -2,7 +2,21 @@
<html lang="en">
<head>
<!-- Required meta tags -->
<!-- add mocha css, to show results -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.css">
<!-- add mocha framework code -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.js"></script>
<script>
mocha.setup('bdd'); // minimal setup
</script>
<!-- add chai -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/3.5.0/chai.js"></script>
<script>
// chai has a lot of stuff, let's make assert global
let assert = chai.assert;
</script>
<!-- Required meta tags for Bootstrap -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
......@@ -10,12 +24,24 @@
</head>
<body>
<div class="alert alert-primary" role="alert">
Excercises of week 1, Tapio Mäntysalo, 28.3.2020, FS2
<div class="alert alert-primary" role="alert">Excercises of week 1, Tapio Mäntysalo, 28.3.2020, FS2</div>
<div class="mx-auto" style="width: 200px;">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Choose action</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="dropdown-main">
<a class="dropdown-item" href="#" id="dropdown-example">Example</a>
<a class="dropdown-item" href="#" id="dropdown-task-1">Task 1</a>
<a class="dropdown-item" href="#" id="dropdown-task-2">Task 2</a>
<a class="dropdown-item" href="#" id="dropdown-task-3">Task 3</a>
</div>
</div>
</div>
<hr>
<!-- Task 3 -->
<div class="container-md">
<div class="container-md task-container" id="task-3">
<div class="jumbotron">
<h1 class="display-4">Task 3</h1>
<p class="lead">Loops and functions</p>
......@@ -88,7 +114,7 @@
</div>
<!-- Task 2 -->
<div class="container-md">
<div class="container-md task-container" id="task-2">
<div class="jumbotron">
<h1 class="display-4">Task 2</h1>
<p class="lead">Loops</p>
......@@ -118,7 +144,7 @@
</div>
<!-- Task 1 -->
<div class="container-md">
<div class="container-md task-container" id="task-1">
<div class="jumbotron">
<h1 class="display-4">Task 1</h1>
<p class="lead">Conditional statements</p>
......@@ -145,7 +171,7 @@
</div>
<!-- Example -->
<div class="container-md">
<div class="container-md task-container" id="example">
<div class="jumbotron">
<h1 class="display-4">Example</h1>
<p class="lead">This is the example provided.</p>
......@@ -191,6 +217,27 @@
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<script>
$(".task-container").hide();
$(".dropdown-item").click(function () {
$(".task-container").hide();
var selection = $(this).attr("id");
switch (selection) {
case "dropdown-example":
$("#example").show();
break;
case "dropdown-task-1":
$("#task-1").show();
break;
case "dropdown-task-2":
$("#task-2").show();
break;
case "dropdown-task-3":
$("#task-3").show();
break;
}
});
</script>
<script src="task3.js"></script>
<script src="task2.js"></script>
<script src="task1.js"></script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment