ClassListts
This commit is contained in:
@ -16,10 +16,27 @@
|
||||
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
|
||||
font-style: italic;
|
||||
}
|
||||
.textone{
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
font-size: 5ch;
|
||||
color: red;
|
||||
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.texttwo{
|
||||
font-style:initial;
|
||||
font-weight: bold;
|
||||
text-decoration: wavy;
|
||||
text-shadow: 3px 3px 3px blue;
|
||||
font-size: 5ch;
|
||||
color: yellow;
|
||||
font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<button class="mybutton">Button 1</button>
|
||||
<button class="mybutton">Button 2</button>
|
||||
<button class="mybutton" id="buttonone">Button 1</button>
|
||||
<button class="mybutton" id="buttontwo">Button 2</button>
|
||||
<button class="mybutton">Button 3</button>
|
||||
<button class="mybutton">Button 4</button>
|
||||
<button class="mybutton">Button 5</button>
|
||||
|
@ -30,4 +30,14 @@ buttons.forEach(button =>{
|
||||
});
|
||||
|
||||
//CLASSLISTS
|
||||
//https://youtu.be/lfmg-EJ8gm4?si=-VAntMYmkAuzoruJ&t=35022
|
||||
|
||||
var buttone = document.getElementById("buttonone");
|
||||
buttone.classList.add("textone"); //add class
|
||||
|
||||
buttone.classList.remove("mybutton"); //remove class
|
||||
|
||||
buttone = document.getElementById("buttontwo");
|
||||
|
||||
buttone.addEventListener("mouseover", event =>{
|
||||
buttone.classList.toggle("texttwo"); //toggle will add if the class is not there and remove if it is there
|
||||
});
|
||||
|
Reference in New Issue
Block a user