-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added `modal` URL parameter and shortcode attribute. - Added `max-width` shortcode attribute. - Added `button-text` shortcode attribute. - Added functions to sanitize and validate shortcode attributes. - Updated documentation.
- Loading branch information
1 parent
e3d9e28
commit 94aa037
Showing
4 changed files
with
308 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
function openModalFromUrl() { | ||
// Check for presence of modal URL parameter | ||
const urlParams = new URLSearchParams(window.location.search); | ||
if (urlParams.has('modal')) { | ||
// If present, trigger modal to open | ||
document.getElementById('chform-modal').style.display = 'block'; | ||
} | ||
} | ||
var modalButton = document.getElementById('chform-modal-button'); | ||
var modal = document.getElementById('chform-modal'); | ||
var closeButton = document.getElementsByClassName('chform-modal-close')[0]; | ||
// Call function to open modal from URL parameter | ||
openModalFromUrl(); | ||
modalButton.addEventListener('click', function () { | ||
modal.style.display = 'block'; | ||
}); | ||
closeButton.addEventListener('click', function () { | ||
modal.style.display = 'none'; | ||
}); | ||
window.addEventListener('click', function (event) { | ||
if (event.target === modal) { | ||
modal.style.display = 'none'; | ||
} | ||
}); | ||
}); |
Oops, something went wrong.