You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
1.0 KiB

  1. /**
  2. * Copyright (c) 2017-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. // Turn off ESLint for this file because it's sent down to users as-is.
  8. /* eslint-disable */
  9. window.addEventListener('load', function() {
  10. // add event listener for all tab
  11. document.querySelectorAll('.nav-link').forEach(function(el) {
  12. el.addEventListener('click', function(e) {
  13. var groupId = e.target.getAttribute('data-group');
  14. document
  15. .querySelectorAll('.nav-link[data-group='.concat(groupId, ']'))
  16. .forEach(function(el) {
  17. el.classList.remove('active');
  18. });
  19. document
  20. .querySelectorAll('.tab-pane[data-group='.concat(groupId, ']'))
  21. .forEach(function(el) {
  22. el.classList.remove('active');
  23. });
  24. e.target.classList.add('active');
  25. document
  26. .querySelector('#'.concat(e.target.getAttribute('data-tab')))
  27. .classList.add('active');
  28. });
  29. });
  30. });