console.log(pic.classList);
//A Dom token list. Array of all the classes that are on that list.
pic.classList.add('open');
pic.classList.remove('cool');
pic.classList.toggle('round');
//Add, remove or toggle a class from an element.
//Create a CSS class that will change it when doing something.
pic.addEventListener('click', toggleRound);
//This will run the function toggleRound once the pic is clicked:
function toggleRound() {
pic.classList.toggle('round');
}
//function that adds and removes the roundness if you round it on the CSS.
A lot of Javascript interaction will be adding or removing classes to elements.
//A Dom token list. Array of all the classes that are on that list.
pic.classList.add('open');
pic.classList.remove('cool');
pic.classList.toggle('round');
//Add, remove or toggle a class from an element.
//Create a CSS class that will change it when doing something.
pic.addEventListener('click', toggleRound);
//This will run the function toggleRound once the pic is clicked:
function toggleRound() {
pic.classList.toggle('round');
}
//function that adds and removes the roundness if you round it on the CSS.
A lot of Javascript interaction will be adding or removing classes to elements.
No comments:
Post a Comment