Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
836 B
4
Indexable
Never
<button id="corner-button" class="fixed-corner-button">Toggle</button>

.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;
}

const cornerButton = document.getElementById('corner-button');

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
}
Leave a Comment