JSFiddle - React, Tailwind, and code Playground
HTML
<div id="horizontalTab">
<ul class="resp-tabs-list">
<li>東京</li>
<li>山形</li>
<li>沖縄</li>
</ul>
<div class="resp-tabs-container">
<div>
<p>2012年現在、国際連合の統計によると、東京は世界最大のメガシティと評価されており、川崎、横浜などとともに世界最大の人口を有する都市圏を形成している。都市単位の経済規模(GDP)ではニューヨークをしのぎ、世界最大である。2012年、アメリカのシンクタンクが公表したビジネス・人材・文化・政治などを対象とした総合的な世界都市ランキングにおいて、ニューヨーク、ロンドン、パリに次ぐ世界第4位の都市と評価された。</p>
</div>
<div>
<p>県域を地図で見ると人間の顔の形(西向きの横顔)をしている。県の東側一帯で宮城県との境に奥羽山脈、県の西部に朝日連峰がそびえているように、県域の大半 (85%) を山地が占め、総面積に対する森林の割合は 75% 、農業用地の割合は15%である。県の中央には最上川が流れる。県民の多くがこの川の流域に住んでいるため、「母なる川」とも呼ばれている。北西側の日本海上には県唯一の離島、飛島がある。</p>
</div>
<div>
<p>日本列島の南、南西諸島の内琉球諸島を占める地域である。南西諸島のうち、屋久島、種子島、トカラ列島、奄美群島は鹿児島県に所属する。それより南で大東諸島や尖閣諸島まで含む。気候は大部分の地域で亜熱帯に属し、宮古島・多良間島・石垣島・西表島・与那国島・波照間島・沖大東島などでは最寒月平均気温が18°C以上の熱帯に属する。</p>
</div>
</div>
</div>
<br />
<br />
<!--vertical Tabs-->
<div id="verticalTab">
<ul class="resp-tabs-list">
<li>東京</li>
<li>山形</li>
<li>沖縄</li>
<li>三重</li>
</ul>
<div class="resp-tabs-container">
<div>
<p>2012年現在、国際連合の統計によると、東京は世界最大のメガシティと評価されており、川崎、横浜などとともに世界最大の人口を有する都市圏を形成している。都市単位の経済規模(GDP)ではニューヨークをしのぎ、世界最大である。2012年、アメリカのシンクタンクが公表したビジネス・人材・文化・政治などを対象とした総合的な世界都市ランキングにおいて、ニューヨーク、ロンドン、パリに次ぐ世界第4位の都市と評価された。</p>
</div>
<div>
<p>県域を地図で見ると人間の顔の形(西向きの横顔)をしている。県の東側一帯で宮城県との境に奥羽山脈、県の西部に朝日連峰がそびえているように、県域の大半 (85%) を山地が占め、総面積に対する森林の割合は 75% 、農業用地の割合は15%である。県の中央には最上川が流れる。県民の多くがこの川の流域に住んでいるため、「母なる川」とも呼ばれている。北西側の日本海上には県唯一の離島、飛島がある。</p>
</div>
<div>
...
CSS
body {
margin: 0px;
padding: 0px;
background: #f5f5f5;
font-family: 'Segoe UI';
}
ul.resp-tabs-list, p {
margin: 0px;
padding: 0px;
}
.resp-tabs-list li {
font-weight: 600;
font-size: 13px;
display: inline-block;
padding: 13px 15px;
margin: 0;
list-style: none;
cursor: pointer;
float: left;
}
.resp-tabs-container {
padding: 0px;
background-color: #fff;
clear: left;
}
h2.resp-accordion {
cursor: pointer;
padding: 5px;
display: none;
}
.resp-tab-content {
display: none;
padding: 15px;
}
.resp-tab-active {
border: 1px solid #c1c1c1;
border-bottom: none;
margin-bottom: -1px !important;
padding: 12px 14px 14px 14px !important;
}
.resp-tab-active {
border-bottom: none;
background-color: #fff;
}
.resp-content-active, .resp-accordion-active {
display: block;
}
.resp-tab-content {
border: 1px solid #c1c1c1;
}
h2.resp-accordion {
font-size: 13px;
border: 1px solid #c1c1c1;
border-top: 0px solid #c1c1c1;
margin: 0px;
padding: 10px 15px;
}
h2.resp-tab-active {
border-bottom: 0px solid #c1c1c1 !important;
margin-bottom: 0px !important;
padding: 10px 15px !important;
}
h2.resp-tab-title:last-child {
border-bottom: 12px solid #c1c1c1 !important;
background: blue;
}
/*-----------Vertical tabs-----------*/
.resp-vtabs ul.resp-tabs-list {
float: left;
width: 30%;
}
.resp-vtabs .resp-tabs-list li {
display: block;
padding: 15px 15px !important;
margin: 0;
cursor: pointer;
float: none;
}
.resp-vtabs .resp-tabs-container {
padding: 0px;
background-color: #fff;
border: 1px solid #c1c1c1;
float: left;
width: 68%;
min-height: 250px;
border-radius: 4px;
clear: none;
}
.resp-vtabs .resp-tab-content {
border: none;
}
.resp-vtabs li.resp-tab-active {
border: 1px solid #c1c1c1;
border-right: none;
background-color: #fff;
position: relative;
...
JavaScript
// Easy Responsive Tabs Plugin
// Author: Samson.Onna <Email : [email protected]>
(function ($) {
$.fn.extend({
easyResponsiveTabs: function (options) {
//Set the default values, use comma to separate the settings, example:
var defaults = {
type: 'default', //default, vertical, accordion;
width: 'auto',
fit: true
}
//Variables
var options = $.extend(defaults, options);
var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion';
//Main function
this.each(function () {
var $respTabs = $(this);
$respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item');
$respTabs.css({
'display': 'block',
'width': jwidth
});
$respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content');
jtab_options();
//Properties Function
function jtab_options() {
if (jtype == vtabs) {
$respTabs.addClass('resp-vtabs');
}
if (jfit == true) {
$respTabs.css({ width: '100%', margin: '0px' });
}
if (jtype == accord) {
$respTabs.addClass('resp-easy-accordion');
$respTabs.find('.resp-tabs-list').css('display', 'none');
}
}
//Assigning the h2 markup
var $tabItemh2;
$respTabs.find('.resp-tab-content').before("<h2 class='resp-accordion' role='tab'><span class='resp-arrow'></span></h2>");
var itemCount = 0;
$respTabs.find('.resp-accordion').each(function () {
$tabItemh2 =...