UNPKG

tabs

Version:

pure javascript implementation that quickly makes the markup tabbable

61 lines (56 loc) 1.5 kB
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .tab-container{ width:60%; margin:100px auto auto auto; } .tabs{ height: 30px; line-height: 30px; } .tabs .tab { display:inline-block; cursor:pointer; width:100px; text-align:center; } .tabs .active { background-color: #efefef } .tab-panes .tab-pane{ border:1px solid #333333; width:400px; padding:20px; display: none } .tab-panes .active{ display: block } </style> </head> <body> <div class="tab-container"> <div class="tabs"> <a class="tab active">Home</a> <a class="tab">Profile</a> <a class="tab">Messages</a> </div> <div class="tab-panes"> <div class="tab-pane active">home</div> <div class="tab-pane">profile</div> <div class="tab-pane" >message</div> </div> </div> <a href="https://github.com/ltebean/tabs"> <img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"/> </a> <script type="text/javascript" src="./index.js"></script> <script type="text/javascript"> var container=document.querySelector('.tab-container') tabs(container); </script> </body> </html>