-
DescriptionI am using Quarto to build an academic website. I want to have my abstracts as buttons and abstract contents in a modal. While I am able to easily incorporate buttons, using standard html, the modal content is not at all wrapping, and I do not see a close icon to close the model. Even pressing escape doesn't help once the modal is opened. In my index.qmd: <button class="abstract-btn">Abstract</button>
<div id="abstractModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Here is the abstract of my research paper. it is a long abstract. I want to see if it wraps or not.>
</div>
</div> JavaScript at the end: <script>
document.querySelectorAll('.abstract-btn').forEach(function(btn) {
btn.onclick = function() {
var modal = document.getElementById('abstractModal');
modal.style.display = "block";
}
});
var span = document.getElementsByClassName("close")[0];
span.onclick = function() {
var modal = document.getElementById('abstractModal');
modal.style.display = "none";
}
window.onclick = function(event) {
var modal = document.getElementById('abstractModal');
if (event.target == modal) {
modal.style.display = "none";
}
}
</script> Content in styles.css to handle the modal
This generates a button which when clicked brings up the following: I would really appreciate any help regarding this! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found a pretty good solution here |
Beta Was this translation helpful? Give feedback.
I found a pretty good solution here