为了账号安全,请及时绑定邮箱和手机立即绑定

多次点击 close和open出现Bug

当多次点击close和open时,UI有明显的“瞬移”。原因是代码中当我们第一次点击open时初始化了对象的style.left,而代码中没有初始化close,我们加上

Sidebar.prototype.close=function(){

console.log('关闭sidebar');

this.el.style.left='0px'; //加这个

this.closeBarEl.style.left='0px';//加这个

this.el.className='sidebar-move-left';

this.closeBarEl.className='closeBar-move-right';

this.state='closed';

};


正在回答

2 回答

....= =#....何必呢。直接写css里面就好了

0 回复 有任何疑惑可以回复我~

good

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

多次点击 close和open出现Bug

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号