Triangle on hover menu with tooltips

This snippet allows for triangles (arrow down) on hover without the need of images and it also provides tooltips.

HTML

<nav>
  <ul>
   
  <li><a href="#" title="Bezoek het forum">Forum</a>

  </ul> 

</nav>

CSS

body {
  font: 13px/1.2 Verdana, sans-serif;
  background: #333;
  z-index: 1;
  color: white;
}
section#content {
  width: 85%;
  margin: 1em auto;
}
h1 {
  font-size: 200%;
  font-weight: bold;
}
nav > ul {
  position: relative;
  z-index: 4
}
ul {
  list-style: none;
  text-align: center;
  background: whiteSmoke;
  background-image: linear-gradient(to bottom, #FFFFFF 0%, #F5F5F5 80%);
  background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #F5F5F5 80%);
  line-height: 2;
}
ul.sub-menu {
  position: absolute;
  margin-top: -2px;
  display: none;
  width: 150px;
  z-index: 3;
}
ul.sub-menu > li {
  display: block;
  font-size: 80%;
}
ul.sub-menu > li a:hover {
  color: black;
}
li {
  display: inline-block;
  font-size: 150%;
  position: relative;
  margin: 0;
}
li.has-sub-menu:hover ul.sub-menu {
  display: block !important;
}
li.has-sub-menu > a {
  padding-right: 1.65em;
}
li.has-sub-menu > a > span {
  border-radius: 100px;
  color: white;
  background: #666;
  padding: 0.5em;
  display: block;
  top: 50%;
  position: absolute;
  right: 0;
  margin-top: -10px;
  margin-right: 0.5em;
  line-height: 1;
  text-shadow: none;
  font-size: 50%;
  font-weight: bold;
  opacity: 1;
  transition: opacity 400ms ease;
  -webkit-transition: opacity 400ms ease;
}
li.has-sub-menu:hover > a > span {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
  opacity: 0;
}
li:hover {
  /* Fixes IE bug that does not display ::after on :hover */
}
li.over-down:hover::after {
  content:"";
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #f5f5f5;
  position: absolute;
  top: 99%;
  top: calc(100% - 2px);
  top: -webkit-calc(100% - 2px);
  left: 50%;
  margin-left: -4px;
}
li.over-right:hover::after {
  content:"";
  width: 0;
  height: 0;
  border-left: 10px solid #f5f5f5;
  border-bottom: 8px solid transparent;
  border-top: 8px solid transparent;
  position: absolute;
  top: 50%;
  left: 100%;
 ...

JavaScript

// Position arrows correctly
$("ul:not(.sub-menu) > li, ul.sub-menu > li:last-child").not(":has(ul.sub-menu)").addClass("over-down");