-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91151b5
commit 251f481
Showing
10 changed files
with
178 additions
and
87 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export const updateContent = ( | ||
/** @type {{ getAttribute: (arg0: string) => any; }} */ element | ||
) => { | ||
console.log("inside") | ||
const modalContentId = element.getAttribute("data-modal-content-id") | ||
const contentDiv = document.getElementById(modalContentId) | ||
|
||
if (contentDiv) { | ||
const content = contentDiv.innerHTML | ||
const modalElement = document.getElementById("exampleModalCenter") | ||
// @ts-ignore | ||
modalElement.querySelector(".modal-body").innerHTML = content | ||
} else { | ||
console.error("Modal content not found for ID:", modalContentId) | ||
} | ||
} | ||
|
||
export const initModalHandler = () => { | ||
console.log("Modal handler initialized.") | ||
const modalTriggers = document.querySelectorAll(".js-modal-trigger") | ||
modalTriggers.forEach(trigger => { | ||
trigger.addEventListener("click", event => { | ||
event.preventDefault() | ||
updateContent(trigger) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.