SkindrikTabs

Simple tab view for beginners.

by Yasin Yoruk

HTML

<div class="skindirik_tabs">

  <ul class="skindirik_tabs_links">
    <li><a href="#tabs1" class="active">Tab title 1</a></li>
    <li><a href="#tabs2">Tab title 2</a></li>
    <li><a href="#tabs3">Embeded Video</a></li>
  </ul>

  <div id="tabs1">
    <p>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
      survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
      publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </p>
  </div>

  <div id="tabs2">

    <p>
      <img src="https://www.stayathomemum.com.au/cache/860x380-0/wp-content/uploads/2015/11/SAHM-Featured_5-Tips-To-Celebrate-A-Summer-Christmas.png" width="100" align="left" title="Summer">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of
      type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
      Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
      <br clear="all" />

    </p>
  </div>

  <div id="tabs3">
    <p>
      <iframe width="560" height="315" src="http://www.youtube-nocookie.com/embed/dU26cGlmkRg?rel=0" frameborder="0" allowfullscreen></iframe>
    </p>
  </div>
</div>

CSS

/* Skindirik Tabs */

.skindirik_tabs div {
  display: none;
  padding: 0 10px;
  border: 1px #ddd solid;
}

.skindirik_tabs #tabs1 {
  display: block;
}

.skindirik_tabs_links {
  list-style: none;
  margin: 5px 0 0 0;
  padding: 0;
}

.skindirik_tabs_links li {
  display: inline-block;
  border: 1px #ddd solid;
  border-bottom: none;
  background: #ecf0f1;
  min-width: 120px;
  text-align: center;
}

.skindirik_tabs_links li a {
  display: block;
  padding: 5px 0;
  color: #666 !important;
}

.skindirik_tabs_links li:hover {
  background: #5D9ADF;
}

.skindirik_tabs_links li:hover a {
  color: #fff !important;
}

.skindirik_tabs_links .active {
  background: #5D9ADF;
  color: #fff !important;
}

JavaScript

$(function() {

  $(".skindirik_tabs_links a").click(function(e) {

    var $this;
    $this = $(this);
    $(".skindirik_tabs div").hide();
    $url = $this.attr("href");
    $($url).fadeToggle("fast");
    $(".skindirik_tabs_links .active").removeClass();
    $this.addClass("active");
    e.preventDefault();
  });

});