The Results
- Customised record title
- Most tennis balls hit into a target in three minutes (team)
- The record
- A new Guinness World Records title was achieved with 255 tennis balls
`;
var tempElement = document.createElement("div");
tempElement.innerHTML = modalHtml;
var modalElement = tempElement.firstChild;
document.body.appendChild(modalElement);
function openModal(link, linkText) {
document.getElementById("modal-container").style.display = "block";
document.getElementById("modal-iframe").src = link;
document.getElementById("modal-link-text").textContent = linkText;
}
function closeModal() {
document.getElementById("modal-container").style.display = "none";
document.getElementById("modal-iframe").src = "";
}
function isYouTubeOrVimeo(url) {
return url.includes("youtube") || url.includes("vimeo");
}
document.querySelectorAll(".modal-link").forEach(function(link) {
link.addEventListener("click", function(event) {
event.preventDefault();
const url = this.getAttribute("href");
const linkText = this.textContent;
if (isYouTubeOrVimeo(url)) {
openModal(url, linkText);
}
});
});
document.getElementById("modal-container").addEventListener("click", function(event) {
if (event.target === this) {
closeModal();
}
});
document.querySelector(".close").addEventListener("click", closeModal);
}
}
videoModalLinks();
videoModal();
};