Advertisement
NecromancerCoding

Pestañas automáticas de categorías

Oct 2nd, 2021 (edited)
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.54 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('.forabg').each(function(){
  3. var id = $(this).attr('id');
  4. var title = $(this).find('.header h2').text();
  5. $(this).parents('#main-content').find('.boardtabs').append('<a class="boardtab" boton="'+id+'">'+title+'</a>');
  6. });
  7.  
  8. $('.boardtab[boton="c1"]').addClass('boardtabactive');
  9.  
  10. $('.boardtab').click(function(){
  11. var id = $(this).attr('boton');
  12. $('.forabg').not('#'+id).slideUp(500);
  13. $('.forabg#'+id).slideDown(500);
  14. $(this).addClass('boardtabactive');
  15. $(this).siblings().removeClass('boardtabactive');
  16. });
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement