Skip to content

Instantly share code, notes, and snippets.

Avatar

VA79 vanaf1979

View GitHub Profile
@vanaf1979
vanaf1979 / RenderedBlocks.php
Created Mar 24, 2021
Are blocks rendered yet
View RenderedBlocks.php
<?php
final class RenderedBlocks {
/**
* instance.
*
* @var RenderedBlocks $instance class instance.
*/
private static $instance = null;
View classlist-toggle-html.html
<div class="box"></div>
<button id="addClass">Add active class</button>
<button id="removeClass">Remove active class</button>
<button id="toggleClass">Toggle active class</button>
View classlist-remove-html.html
<div class="box"></div>
<button id="addClass">Add active class</button>
<button id="removeClass">Remove active class</button>
View classlist-add-html.html
<div class="box"></div>
<button id="addClass">Add active class</button>
View classlist-toggle-js.js
const box = document.querySelector(".box");
const toggleButton = document.querySelector('#toggleClass');
toggleButton.addEventListener('click', () => {
box.classList.toggle("active");
});
View classlist-remove-js.js
const box = document.querySelector(".box");
const removeButton = document.querySelector('#removeClass');
removeButton.addEventListener('click', () => {
box.classList.remove("active");
});