第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

跟著老師打代碼,游覽器提示‘addEventListener’為空

(function(){

var Menubar=function(){

this.el=document.querySelector('#sidebar ul');

this.state='allClosed';

this.el.addEventListener('click',function(e){//提示‘a(chǎn)ddEventListener’為空

e.stopPropagation();

});

}

var Sidebar=function(eId,closeBarId){

this.state='opened';

this.el=document.getElementById(eId||'sidebar');

this.closeBarEl=document.getElementById('closeBarId'||'closeBar ');

var self=this;

this.menubar=new Menubar();

this.el.addEventListener('click',function(event){

if(event.target!==this.el){

self.triggerSwich();

}

});

};

Sidebar.prototype.close=function(){

console.log('關(guān)閉');

this.state='closed'

};

Sidebar.prototype.open=function(){

console.log('打開');

this.state='opened';

};

Sidebar.prototype.triggerSwich=function(){

if(this.state==='opened'){

this.close();

}else{

this.open();

}

};

var sidebar=new Sidebar();

})();

Uncaught TypeError: Cannot read property 'addEventListener' of null

正在回答

1 回答

打印一下?this.el 你就知道錯(cuò)在哪邊了


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
側(cè)邊欄信息展示效果
  • 參與學(xué)習(xí)       33649    人
  • 解答問題       101    個(gè)

頂級(jí)大牛分享開發(fā)經(jīng)驗(yàn),學(xué)會(huì)實(shí)現(xiàn)側(cè)邊欄內(nèi)容效果展示,讓你迅速進(jìn)階

進(jìn)入課程

跟著老師打代碼,游覽器提示‘addEventListener’為空

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)