add table of contents button
This commit is contained in:
parent
55c090ada6
commit
dd8c404cae
4 changed files with 145 additions and 3 deletions
20
script.js
20
script.js
|
|
@ -19,6 +19,26 @@ window.onclick = function(event) {
|
|||
}
|
||||
}
|
||||
|
||||
// Same snippet as above, but for the Table of Contents of button.
|
||||
function tocDropdown() {
|
||||
document.getElementById("toc-dropdown").classList.toggle("show-dropdown");
|
||||
}
|
||||
|
||||
// Close the dropdown menu if the user clicks outside of it
|
||||
window.onclick = function(event) {
|
||||
if (!event.target.matches('.toc-button')) {
|
||||
var dropdowns = document.getElementsByClassName("toc-content");
|
||||
var i;
|
||||
for (i = 0; i < dropdowns.length; i++) {
|
||||
var openDropdown = dropdowns[i];
|
||||
if (openDropdown.classList.contains('show-dropdown')) {
|
||||
openDropdown.classList.remove('show-dropdown');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Replace the above(s) with CSS?
|
||||
|
||||
// snippet that copies the html for my button(s)
|
||||
function copyButtonRegular() {
|
||||
navigator.clipboard.writeText ('<a href="https://sneexy.pages.gay"><img src="https://sneexy.pages.gay/assets/buttons/sneexy.png" alt="Sneexy" title="Sneexy"></a>');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue