Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active May 27, 2022 02:05
Show Gist options
  • Save kobitoDevelopment/f7a87274b21bb57e078a81c406537dee to your computer and use it in GitHub Desktop.
Save kobitoDevelopment/f7a87274b21bb57e078a81c406537dee to your computer and use it in GitHub Desktop.
<p class="hoge">テスト</p>
<p class="fuga">終了を検知1</p>
<p class="piyo">終了を検知2</p>
const hoge = document.querySelector(".hoge");
const fuga = document.querySelector(".fuga");
const piyo = document.querySelector(".piyo");
hoge.classList.add("is-active");
hoge.addEventListener("transitionend", function () {
fuga.classList.add("is-active");
});
fuga.addEventListener("transitionend", function () {
piyo.classList.add("is-active");
});
.hoge {
color: black;
transition: 2s;
&.is-active {
color: red;
}
}
.fuga {
color: black;
transition: 2s;
&.is-active {
color: blue;
}
}
.piyo {
color: black;
&.is-active {
color: green;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment