Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } * box-sizing: border-box .container position: absolute left: calc(50% - 24px) top: calc(50% - 24px) transform: scale(1.5) .clappingboard position: relative width: 48px height: 48px border-radius: 24px padding: 12px cursor: pointer -webkit-tap-highlight-color: transparent transition: background .2s ease .clap transition: all .2s ease .light position: absolute top: 26px left: 17px width: 3px height: 3px border-radius: 50% background: #8C8C8C &:hover background: rgba(black,.04) .clap transform: rotate(-10deg) translate3d(-1.5px,1px,0) &.active animation: clipclap .2s forwards animation-delay: .06s .clap transform: rotate(0) translate3d(0,0,0) .light background: #FF2828 box-shadow: 0 0 3px .5px #FF2828 @keyframes clipclap 0% transform: translate3d(0,0,0) rotate(0) 40% transform: translate3d(0,1px,0) rotate(4deg) 1000% transform: translate3d(0,0,0) rotate(0)
console.log("Event Fired") const svgElement = document.querySelector('.clappingboard'); const clapSound = document.getElementById('clapSound'); svgElement.addEventListener('click', () => { if (!svgElement.classList.contains('active')) { clapSound.play(); } svgElement.classList.toggle('active'); });