This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
element.addEventListener('touchmove', doSomething(), { passive: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.box { | |
contain: style; //will limit the scope of styles to this element and its children | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wrapperHeight = wrapper.getBoundingClientRect().height + 'px'; | |
boxes.forEach(box => { | |
box.style.transform = “translateY(“ + wrapperHeight + “px)”; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boxes.forEach(box => { | |
box.style.transform = “translateY(“ + wrapper.getBoundingClientRect().height + “px)”; | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSomething() { | |
requestAnimationFrame(doSomething); | |
// Do stuff | |
} | |
doSomething(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var box = document.getElementById("box") | |
box.addEventListener("click", function(){ | |
box.classList.toggle("class-name"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyframes spin { | |
from {transform: rotate(0deg);} | |
to {transform: rotate(360deg);} | |
} | |
.box { | |
animation-name: spin; | |
animation-duration: 3ms; | |
animation-iteration-count: infinite; | |
animation-timing-function: linear; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.box { | |
will-change: auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.box { | |
position: relative; | |
} | |
.box:before { | |
content: “”; | |
box-shadow: 1px 1px 1px rgb(0,0,0); | |
opacity: .5; | |
transition: .2s; | |
position: absolute; | |
width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.box { | |
box-shadow: 1px 1px 1px rgba(0,0,0,.5); | |
transition: .2s; | |
} | |
.active { | |
box-shadow: 1px 1px 1px rgba(0,0,0,1); | |
} |
NewerOlder