Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Team Page - Show team modal
- document.addEventListener("DOMContentLoaded", function () {
- const body = document.body;
- // Show team modal
- document.querySelectorAll('.team-member-thumb-wrap').forEach(thumb => {
- thumb.addEventListener('click', function () {
- const modal = this.nextElementSibling;
- if (modal && modal.classList.contains('team-modal')) {
- modal.classList.add('active');
- body.classList.add('stopScroll');
- // Update URL with hash
- const dataUrl = this.getAttribute('data-url');
- if (dataUrl) {
- const baseUrl = window.location.href.split('#')[0];
- history.replaceState({}, document.title, '${baseUrl}#${dataUrl}');
- }
- }
- });
- });
- // Close team modal
- document.querySelectorAll('.team-modal .close').forEach(closeBtn => {
- closeBtn.addEventListener('click', function () {
- document.querySelectorAll('.team-modal.active').forEach(modal => {
- modal.classList.remove('active');
- });
- body.classList.remove('stopScroll');
- });
- });
- // // Handle "Show All" button
- // const showAllButton = document.querySelector('.show-all');
- // if (showAllButton) {
- // showAllButton.addEventListener('click', function () {
- // this.remove();
- // document.querySelectorAll('.overflow').forEach(el => {
- // el.classList.remove('overflow');
- // });
- // });
- // }
- // Automatically open modal based on hash
- const hash = window.location.hash.slice(1); // Remove the '#' from the hash
- if (hash) {
- const modal = document.querySelector('.team-member-thumb-wrap[data-url="${hash}"] + .team-modal');
- if (modal) {
- modal.classList.add('active');
- body.classList.add('stopScroll');
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement