Demo of simple tabs without jQuery UI

HTML

Open a tab and it gains the class <i>.current</i>. How to remove that class when the tab is closed and no other tab is opened.

<div id="tabs-container">
  <div class="tabs-menu">
    <div><a href="#tab-1">One</a></div>
    <div><a href="#tab-2">Two</a></div>
    <div><a href="#tab-3">Three</a></div>
    <div><a href="#tab-4">Four</a></div>
  </div>
  <div class="tab">
    <div id="tab-1" class="tab-content">
      Hello
    </div>
    <div id="tab-2" class="tab-content">
      Number Two
    </div>
    <div id="tab-3" class="tab-content">
      Tab 3
    </div>
    <div id="tab-4" class="tab-content">
      Bye
    </div>
  </div>
</div>

CSS

body {
  padding: 20px;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  font-size: 14px;
}

#tabs-container {
  margin: 30px 0;
  display: block;
}

.tabs-menu {
  height: 30px;
  float: left;
  clear: both;
}

.tabs-menu div {
  height: 30px;
  line-height: 30px;
  float: left;
  margin-right: 10px;
  background-color: #ffc3c3;
  border-radius: 10px 10px 0 0;
}

.tabs-menu div.current {
  position: relative;
  background-color: #fff;
  z-index: 5;
}

.tabs-menu div a {
  padding: 10px;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
}

.tabs-menu .current a {
  color: #df0000;
}

.tab {
  background-color: #fff;
  float: left;
  margin-bottom: 20px;
  width: auto;
}

.tab-content {
  width: 660px;
  padding: 20px;
  display: none;
  border-radius: 0 0 10px 10px;
}

JavaScript

$(document).ready(function() {
  $(".tabs-menu a").click(function(event) {
    event.preventDefault();
    $(this).parent().addClass("current");
    $(this).parent().siblings().removeClass("current");
    var tab = $(this).attr("href");
    $(".tab-content").not(tab).css("display", "none");
    $(tab).slideToggle();
  });
});