micsco987

tabbers

Jan 23rd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <!--below is the javascript, put this right above the meta tags-->
  2.  
  3. <script type="text/javascript" src="http://static.tumblr.com/7gk7xdc/t1Mnqtxfn/jquery-1.9.1.min.js"></script>
  4. <script type="text/javascript" src="http://static.tumblr.com/7gk7xdc/6vVnqtxgf/tabs.js"></script>
  5. <script type="text/javascript">
  6. $(document).ready(function(){
  7. $("ul#tabs li").click(function(e){
  8. if (!$(this).hasClass("active")) {
  9. var tabNum = $(this).index();
  10. var nthChild = tabNum+1;
  11. $("ul#tabs li.active").removeClass("active");
  12. $(this).addClass("active");
  13. $("ul#tab li.active").removeClass("active");
  14. $("ul#tab li:nth-child("+nthChild+")").addClass("active");
  15. }
  16. });
  17. });
  18. </script>
  19.  
  20.  
  21.  
  22.  
  23. /*here's the css ; put it anywhere after <style></style> and before <body>*/
  24.  
  25. ul#tabs {
  26. list-style-type: none;
  27. padding: 0;
  28. text-align: center;
  29. }
  30. ul#tabs li {
  31. text-shadow:none;
  32. font-size:11px;
  33. display: inline-block;
  34. padding: 2px;
  35. margin-bottom: 4px;
  36. color: #ccc;
  37. cursor: pointer;
  38. -webkit-transition: all 0.4s ease-in-out;
  39. -moz-transition: all 0.4s ease-in-out;
  40. -o-transition: all 0.4s ease-in-out;
  41. -ms-transition: all 0.4s ease-in-out;
  42. transition: all 0.4s ease-in-out;
  43. }
  44. ul#tabs li:hover {
  45. color:#fff;
  46. -webkit-transition: all 0.4s ease-in-out;
  47. -moz-transition: all 0.4s ease-in-out;
  48. -o-transition: all 0.4s ease-in-out;
  49. -ms-transition: all 0.4s ease-in-out;
  50. transition: all 0.4s ease-in-out;
  51. }
  52. ul#tabs li.active {
  53. color: #fff;
  54. }
  55. ul#tab {
  56. list-style-type: none;
  57. margin: 0;
  58. padding: 0;
  59. }
  60. ul#tab li {
  61. display: none;
  62. }
  63. ul#tab li.active {
  64. display: block;
  65. }
  66.  
  67.  
  68.  
  69.  
  70.  
  71. <!--- & here's the html ; put it between <body></body>----->
  72.  
  73. <ul id="tabs">
  74. <li class="active">tab 1</li>
  75. <li>tab 2</li>
  76. <li>tab 3</li>
  77. <li>tab 4</li>
  78. </ul>
  79.  
  80. <ul id="tab">
  81.  
  82. <li class="active">
  83.  
  84. tab 1 content here
  85.  
  86. </li>
  87.  
  88. <!-------------------------------------->
  89.  
  90. <li>
  91.  
  92. tab 2 content here
  93.  
  94. </li>
  95.  
  96. <!-------------------------------------->
  97.  
  98. <li>
  99.  
  100. tab 3 content here
  101.  
  102. </li>
  103.  
  104. <!-------------------------------------->
  105.  
  106. <li>
  107.  
  108. tab 4 content here
  109.  
  110. </li>
  111. </ul>
Advertisement
Add Comment
Please, Sign In to add comment