[{id:1, name: test},
{id:2, name: test2},
{id:3, name: test3}].find(item => item.id === 2) // {id:2, name: test2}
let panes = document.querySelectorAll('.pane');
for (let pane of panes) {
pane.querySelector('.remove-button').addEventListener('click', onRemoveClick)
}
function onRemoveClick(evt){
evt.target.closest('.pane').remove()
}
addEventListener
писать два события.click touch
.active{
animation-name: toggle;
animation-duration: 0.3s;
animation-timing-function: ease-in-out;
}
@keyframes toggle{
50% {transform: scale(0.7)}
100% {transform: scale(1)}
}
leftBtn.addEventListener('click', (evt) => {
leftBtn.classList.add('active')
setTimeout(()=>{
leftBtn.classList.remove('active')
}, 300)
})
TweenLite.defaultEase = Linear.easeNone;
var controller = new ScrollMagic.Controller();
var tl = new TimelineMax();
var pannelEffectsMap = {
0: {xPercent: 100},
1: {xPercent: -100},
2: {yPercent: 100},
};
var panels = document.querySelectorAll('.panel');
panels.forEach(function(panel, index){
if(index !== 0){
var mapIndex = index % 3 // Так как в pannelEffectsMap только 3 "эффекта"
tl.from(panel, 1, pannelEffectsMap[mapIndex]);
}
})
new ScrollMagic.Scene({
triggerElement: "#pinMaster",
triggerHook: "onLeave",
duration: "200%"
})
.setPin("#pinMaster")
.setTween(tl)
.addIndicators({
colorTrigger: "white",
colorStart: "white",
colorEnd: "white",
indent: 40
})
.addTo(controller);