You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constpanels=Array.from(document.querySelectorAll('.panel'));functiontoggleOpen(e){this.classList.toggle('open');this.classList.toggle('open-active');// get siblingsvars=[].filter.call(this.parentNode.children,(child)=>child!==this);s.forEach(s=>s.classList.remove('open'))}panels.forEach(panel=>panel.addEventListener('click',toggleOpen));
PS:昨天在Issue里被@后才发现这里,解决了自己的一个纠结问题,真是不错,一起学习哈~
The text was updated successfully, but these errors were encountered:
toggle open
后面toggle open-active
,和原效果一致,好处是不用修改CSS
了PS:昨天在Issue里被@后才发现这里,解决了自己的一个纠结问题,真是不错,一起学习哈~
The text was updated successfully, but these errors were encountered: