Last active
November 10, 2017 06:55
-
-
Save goofmint/fad6b51c262274a4dbaac84ef458f91f to your computer and use it in GitHub Desktop.
Revisions
-
goofmint revised this gist
Nov 10, 2017 . 2 changed files with 3 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,33 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ $('.tabbable').each(function() { h5.core.controller(this, tabbableController); }); -
goofmint created this gist
Mar 14, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ hifiveのUIコンポーネント紹介「タブ切り替え」 hifiveは業務システム開発用とあって、Bootstrapと組み合わせて使われることが多いのですが、Bootstrap側の制限が動作に影響を及ぼしてしまうことがあります。その一つとして今回はタブ切り替えを行うUIをhifive風に実装する方法を紹介します。 今回の[デモはこちら](https://jsfiddle.net/r874onxz/)にあります。 ## 使い方 ### HTMLの記述 HTML側の記述は次のようになります。特徴としてはBootstrap標準ではidを使わなければならないところをクラスだけで指定しているところが異なります。 https://gist.github.com/e1542b36afb02642362a1b5a4d931ab4 ### JavaScriptの記述 そしてJavaScriptはタブをクリックした際のイベントを取得して、コンテンツの表示/非表示を切り替えます。 https://gist.github.com/baf45b16439d6f7e75c12482ef982d3e さらにタブのグループ毎にコントローラを適用することで、各タブを独立させた状態で扱えるようになります。 ``` $('.tabbable').each(function() { h5.core.controller(this, tabbableController); }); ``` ---- この方法であればBootstrapのJavaScriptを使わずにタブ機能が実装できます。Bootstrapは便利なライブラリですが制約も多くなっていますので、カスタマイズしやすい形を目指すのであればこうした実装がお勧めです。 [タブ切り替え](http://hifive.github.io/hifive-ui-library/hifive-ui-library/WebContent/components/tabbable/index.html)