Last active
February 20, 2016 10:17
-
-
Save maninthemirror/a47e9fce7e59c4145c41 to your computer and use it in GitHub Desktop.
jQueryTab
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 characters
| <!-- tab切換 --> | |
| <div class="tabZone"> | |
| <!-- 點數 --> | |
| <ul class="tabUl tabAreaFunc"> | |
| <li class="tabActive">獲得明細</li> | |
| <li class="taboff">使用明細</li> | |
| </ul> | |
| <!-- end點數--> | |
| <!-- 內容區域--> | |
| <div class="tabArea contentPaddingLR" id="tabArea0"> | |
| <table class="twoli"> | |
| <tbody> | |
| <tr> | |
| <th>折抵商品</th> | |
| <th>折抵金額</th> | |
| <th>時間</th> | |
| <th>狀態</th> | |
| </tr> | |
| <tr> | |
| <td></td> | |
| <td></td> | |
| <td></td> | |
| <td></td> | |
| </tr> | |
| <tr> | |
| <td></td> | |
| <td></td> | |
| <td></td> | |
| <td></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div class="tabArea" id="tabArea1">2222</div> | |
| <!-- end內容區域--> | |
| </div> | |
| <!-- end tab切換 --> |
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 characters
| .tabUl { | |
| margin-top: 30px; | |
| padding-left: 30px; | |
| padding-right: 10px; | |
| box-sizing: border-box; | |
| border-bottom: 1px solid #bfbfbf; | |
| } | |
| .tabUl:after { | |
| content: ""; | |
| display: table; | |
| clear: both; | |
| } | |
| .tabUl li { | |
| border-right: 1px solid; | |
| border-color: #bfbfbf; | |
| padding: 30px 50px; | |
| float: left; | |
| margin-bottom: -1px; | |
| } | |
| .tabUl li:first-child { | |
| border-left: 1px solid #bfbfbf; | |
| } | |
| .tabUl .tabActive { | |
| border-top: 6px solid #fdb365; | |
| background-color: white; | |
| border-bottom: 1px solid white; | |
| } | |
| .tabUl .taboff { | |
| border-top: 6px solid white; | |
| background-color: #898989; | |
| color: white; | |
| } | |
| .tabArea { | |
| border: 1px solid #bfbfbf; | |
| border-top: 1px solid white; | |
| } | |
| #tabArea1 { | |
| display: none; | |
| } |
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 characters
| $("body").on('click', '.tabAreaFunc li', function(event) { | |
| event.preventDefault(); | |
| var num = $(this).index(), | |
| $tabArea = $(".tabArea"), | |
| $tabAreaID = $tabArea.attr("id").charAt(7), | |
| $tabAreaShowed = $("#tabArea"+num); | |
| console.log($(this).index()); | |
| $tabAreaShowed.fadeIn(); | |
| $(".tabArea").not($tabAreaShowed).css('display', 'none'); | |
| $(this).removeClass().addClass('tabActive'); | |
| $(".tabAreaFunc li").not($(this)).removeClass().addClass('taboff'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment