Advertisement
maximus87

Untitled

Jan 28th, 2025
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. // Team Page - Show team modal
  2. document.addEventListener("DOMContentLoaded", function () {
  3. const body = document.body;
  4.  
  5. // Show team modal
  6. document.querySelectorAll('.team-member-thumb-wrap').forEach(thumb => {
  7. thumb.addEventListener('click', function () {
  8. const modal = this.nextElementSibling;
  9. if (modal && modal.classList.contains('team-modal')) {
  10. modal.classList.add('active');
  11. body.classList.add('stopScroll');
  12.  
  13. // Update URL with hash
  14. const dataUrl = this.getAttribute('data-url');
  15. if (dataUrl) {
  16. const baseUrl = window.location.href.split('#')[0];
  17. history.replaceState({}, document.title, '${baseUrl}#${dataUrl}');
  18. }
  19. }
  20. });
  21. });
  22.  
  23. // Close team modal
  24. document.querySelectorAll('.team-modal .close').forEach(closeBtn => {
  25. closeBtn.addEventListener('click', function () {
  26. document.querySelectorAll('.team-modal.active').forEach(modal => {
  27. modal.classList.remove('active');
  28. });
  29. body.classList.remove('stopScroll');
  30. });
  31. });
  32.  
  33. // // Handle "Show All" button
  34. // const showAllButton = document.querySelector('.show-all');
  35. // if (showAllButton) {
  36. // showAllButton.addEventListener('click', function () {
  37. // this.remove();
  38. // document.querySelectorAll('.overflow').forEach(el => {
  39. // el.classList.remove('overflow');
  40. // });
  41. // });
  42. // }
  43.  
  44. // Automatically open modal based on hash
  45. const hash = window.location.hash.slice(1); // Remove the '#' from the hash
  46. if (hash) {
  47. const modal = document.querySelector('.team-member-thumb-wrap[data-url="${hash}"] + .team-modal');
  48. if (modal) {
  49. modal.classList.add('active');
  50. body.classList.add('stopScroll');
  51. }
  52. }
  53. });
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement