<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Hold Shift to Check Multiple Checkboxes</title>

  <link rel="stylesheet" href="./styles.css"/>
</head>
<body>
  <h1 class="title">Multiple Check</h1>

  <ul class="multiple-check-list">
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
    <li class="multiple-check-item">
      <input type="checkbox" class="multiple-check-checkbox">
      <span class="multiple-check-text">Lorem ipsum dolor sit amet</span>
    </li>
  </ul>

  <script src="./scripts.js"></script>
</body>
</html>
@import url('https://fonts.googleapis.com/css?family=Rock+Salt');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-direction: column;
  background: #00bcd4;
}

.title {
  color: #DB167C;
  font-family: 'Rock Salt', cursive;
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
}

.multiple-check-list {
  width: 390px;
  height: 70%;
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

.multiple-check-item {
  list-style: none;
  flex: 1;
  display: flex;
  align-items: center;
}

.multiple-check-item .multiple-check-checkbox {
  flex: 1.5;
}

.multiple-check-item .multiple-check-checkbox:checked + .multiple-check-text {
  text-decoration: line-through;
}

.multiple-check-item .multiple-check-text {
  flex: 6;
  font-size: 20px;
}

@media screen and (max-height: 500px) {
  .title { font-size: 28px; }
  .multiple-check-list { height: 70vh; }
  .multiple-check-item:nth-child(7n+5),
  .multiple-check-item:nth-child(7n+6),
  .multiple-check-item:nth-child(7n+7) { display: none; }
  .multiple-check-item .multiple-check-text { font-size: 18px; }
}
const  checkboxes = document.querySelectorAll('input.multiple-check-checkbox');

let inBetween = false,
    lastChecked;

let checkBox = (e) => {
  if (e.shiftKey && e.target.checked) {
    checkboxes.forEach(checkbox => {
      if (checkbox === e.target || checkbox === lastChecked) {
        inBetween = !inBetween;
      }

      if (inBetween) { checkbox.checked = true; }
    });
  }

  lastChecked = e.target;
}

checkboxes.forEach(checkbox => checkbox.addEventListener('click', checkBox));