Select Based Responsive Tabs Plugin For jQuery - responsiveTabs

File Size: 5.78 KB
Views Total: 1712
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Select Based Responsive Tabs Plugin For jQuery - responsiveTabs

Just another jQuery responsive tabbed system which converts horizontal tabs into a select dropdown list on small screen devices.

How to use it:

1. Place jQuery library and the jQuery responsiveTabs plugin's JavaScript file at the bottom of the html page.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> 
<script src="responsive-tabs.js"></script>

2. Create a tabbed system with plain html structure.

<div id="respTabs">
  <div>
    <h2>Tab 1</h2>
    <div>
      Content 1
    </div>
  </div>
  <div>
    <h2>Tab 2</h2>
    <div>
      Content 2
    </div>
  </div>
  <div>
    <h2>Tab 3</h2>
    <div>
      Content 3
    </div>
  </div>
</div>

3. You can set one of the tabs as the default tab using resp-tab="default" attribute.

<div resp-tab="default">
  ...
</div>

4. Call the function on the top container as follow:

$('#respTabs').responsiveTabs();

5. Add your own CSS styles to the tabbed system.

.resp-headings { display: none; }

.resp-contents { margin: 0.6em 0 0 0.5em; }
 @media (max-width: 480px) {

.resp-tablist { display: none; }

.resp-tabDrop {
  display: block;
  width: 100%;
  height: 35px;
  font-size: 1.2em;
  margin: 1em 0 0 0;
}
}
@media (min-width: 481px) {

.resp-tabDrop { display: none; }

.resp-tablist {
  display: block;
  font-size: 1.2em;
  margin: 2em 0 0 0;
  padding: 0;
  border-bottom: 1px solid #ddd;
  padding-bottom: 11px;
  line-height: 1em;
}

.resp-tablistItem {
  display: inline;
  cursor: pointer;
  background: #eee;
  padding: 10px 20px;
  border: 1px solid #ddd;
  margin-right: 0.1em;
}

.resp-tablistItem__active {
  background: #fff;
  border-bottom-color: #fff;
}
}

This awesome jQuery plugin is developed by pandeyanupj. For more Advanced Usages, please check the demo page or visit the official website.