点击按钮弹框的出现以及有关闭的按钮

利用的es6+jQuery来实现的效果
const bth=document.getElementById('bth');
const shadow =document.getElementById('shadow');

bth.addEventListener('click', (e)=> {
shadow.className='shadow show';
return false

},false)
//弹框的出现
shadow.addEventListener('click',(e)=>{
const target=e.target;
const _class=target.className;
if(_class.includes('shadow')||_class.includes('close')){
shadow.className='shadow'
}
return false
},false)
//弹框的关闭
posted @ 2021-12-26 16:40  李小聪明  阅读(71)  评论(0)    收藏  举报