Advertisement
itskrystalized

tab content 02# >> javascript

Jul 1st, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="http://krystalized.gportal.hu/portal/krystalized/upload/754724_1435743522_09899.js"></script>
  2. <script>
  3. $(function() {
  4.   $('.tabs nav a').on('click', function() {
  5.     show_content($(this).index());
  6.   });
  7.  
  8.   show_content(0);
  9.  
  10.   function show_content(index) {
  11.     // Make the content visible
  12.     $('.tabs .content.visible').removeClass('visible');
  13.     $('.tabs .content:nth-of-type(' + (index + 1) + ')').addClass('visible');
  14.  
  15.     // Set the tab to selected
  16.     $('.tabs nav a.selected').removeClass('selected');
  17.     $('.tabs nav a:nth-of-type(' + (index + 1) + ')').addClass('selected');
  18.   }
  19. });
  20. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement