Untitled
unknown
plain_text
a year ago
942 B
7
Indexable
const cornerButton = document.createElement('button'); cornerButton.textContent = 'Toggle'; cornerButton.className = 'fixed-corner-button'; document.body.appendChild(cornerButton); cornerButton.addEventListener('click', () => { if (cornerButton.classList.contains('active')) { disableFunctions(); cornerButton.classList.remove('active'); } else { enableFunctions(); cornerButton.classList.add('active'); } }); function enableFunctions() { // Call function 1 function1(); // Call function 2 function2(); } function disableFunctions() { // Disable function 1 // Disable function 2 } .fixed-corner-button { position: fixed; bottom: 0; right: 0; z-index: 1000; padding: 10px 20px; border: none; border-radius: 50%; background-color: #333; color: #fff; cursor: pointer; } .fixed-corner-button:hover { background-color: #444; } .fixed-corner-button.active { background-color: #666; }
Editor is loading...
Leave a Comment