レスポンシブ対応のタブ JS

サイトマップ

ホームページとデザインの会社
株式会社ジェイプラン

menu
 
  レスポンシブ対応のタブ JS

レスポンシブ対応のタブ JS

ダウンロードはこちら

デモはこちら

以下のようにjQuery 1.7.0以上とダウンロードしたファイルから jquery.responsiveTabs.min.js と responsive-tabs.css を読み込むコードをヘッダーに記述

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”></script>

<script src=”js/jquery.responsiveTabs.min.js”></script>

<link rel=”stylesheet” href=”css/responsive-tabs.css”>

 

HTMLはサンプルコードを参考に以下を記述

<!–Horizontal Tab–>
<div id=”parentHorizontalTab”>
<ul class=”resp-tabs-list hor_1″>
<li>Horizontal 1</li>
<li>Horizontal 2</li>
<li>Horizontal 3</li>
</ul>
<div class=”resp-tabs-container hor_1″>
<div>
<p>
<!–vertical Tabs–>

<div id=”ChildVerticalTab_1″>
<ul class=”resp-tabs-list ver_1″>
<li>Responsive Tab 1</li>
<li>Responsive Tab 2</li>
<li>Responsive Tab 3</li>
<li>Long name Responsive Tab 4</li>
</ul>
<div class=”resp-tabs-container ver_1″>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravida mollis.</p>
</div>
<div>
<p>Lorem ipsum dolor sit amet, lerisque commodo. Nam porta cursus lectusconsectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales sce. Proin nunc erat, gravida a facilisis quis, ornare id lectus</p>
</div>
<div>
<p>Suspendisse blandit velit Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravid urna gravid eget erat suscipit in malesuada odio venenatis.</p>
</div>
<div>
<p>d ut ornare non, volutpat vel tortor. InLorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravida mollis.t in malesuada odio venenatis.</p>
</div>
</div>
</div>
</p>
<p>Tab 1 Container</p>
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravida mollis.
<br>
<br>
<p>Tab 2 Container</p>
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravida mollis.
<br>
<br>
<p>Tab 3 Container</p>
</div>
</div>
</div>
<div id=”nested-tabInfo”>
Selected tab: <span class=”tabName”></span>
</div>
<br/>
<br/>
<br/>
<h2>Vertical Tab with (Nested Tabs) </h2>
<br/>
<!–Vertical Tab–>
<div id=”parentVerticalTab”>
<ul class=”resp-tabs-list hor_1″>
<li>Vertical 1</li>
<li>Vertical 2</li>
<li>Vertical 3</li>
</ul>
<div class=”resp-tabs-container hor_1″>
<div>
Lorem ipsum dolor sit amet, lerisque commodo. Nam porta cursus lectusconsectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales sce. Proin nunc erat, gravida a facilisis quis, ornare id lectus.
<br>
<br>
<p>Tab 1 Container</p>
</div>
<div>
Lorem consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis.
<br>
<br>
<p>Tab 2 Container</p>
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nibh urna, euismod ut ornare non, volutpat vel tortor. Integer laoreet placerat suscipit. Sed sodales scelerisque commodo. Nam porta cursus lectus. Proin nunc erat, gravida a facilisis quis, ornare id lectus. Proin consectetur nibh quis urna gravida mollis.
<br>
<br>
<p>Tab 3 Container</p>
</div>
</div>
</div>

 

オプション設定のjsをbodyの前に記述

<script type=”text/javascript”>
$(document).ready(function() {
//Horizontal Tab
$(‘#parentHorizontalTab’).easyResponsiveTabs({
type: ‘default’, //Types: default, vertical, accordion
width: ‘auto’, //auto or any width like 600px
fit: true, // 100% fit in a container
tabidentify: ‘hor_1’, // The tab groups identifier
activate: function(event) { // Callback function if tab is switched
var $tab = $(this);
var $info = $(‘#nested-tabInfo’);
var $name = $(‘span’, $info);
$name.text($tab.text());
$info.show();
}
});

// Child Tab
$(‘#ChildVerticalTab_1’).easyResponsiveTabs({
type: ‘vertical’,
width: ‘auto’,
fit: true,
tabidentify: ‘ver_1’, // The tab groups identifier
activetab_bg: ‘#fff’, // background color for active tabs in this group
inactive_bg: ‘#F5F5F5’, // background color for inactive tabs in this group
active_border_color: ‘#c1c1c1’, // border color for active tabs heads in this group
active_content_border_color: ‘#5AB1D0’ // border color for active tabs contect in this group so that it matches the tab head border
});

//Vertical Tab
$(‘#parentVerticalTab’).easyResponsiveTabs({
type: ‘vertical’, //Types: default, vertical, accordion
width: ‘auto’, //auto or any width like 600px
fit: true, // 100% fit in a container
closed: ‘accordion’, // Start closed if in accordion view
tabidentify: ‘hor_1’, // The tab groups identifier
activate: function(event) { // Callback function if tab is switched
var $tab = $(this);
var $info = $(‘#nested-tabInfo2’);
var $name = $(‘span’, $info);
$name.text($tab.text());
$info.show();
}
});
});
</script>

印刷はこんなに安かったの?

梅オーナー情報はこちら

おすすめレンタルサーバー

独自SLLが無料!月額100円~使える!使いやすく初心者にお勧め!


ホームページお役立ち情報

記事はありません

お探しの記事は見つかりませんでした。

東京・千葉の中国語教室

中国語教室