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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何使用導(dǎo)航欄創(chuàng)建單頁(yè)應(yīng)用程序?

如何使用導(dǎo)航欄創(chuàng)建單頁(yè)應(yīng)用程序?

元芳怎么了 2021-04-19 16:14:43
因此,我的目標(biāo)是創(chuàng)建一個(gè)與導(dǎo)航欄一起使用的單頁(yè)應(yīng)用程序。這是一個(gè)音樂(lè)評(píng)論網(wǎng)站,因此導(dǎo)航欄上會(huì)顯示“ Pop”,“ HipHop”和“ Jazz”。對(duì)于每種音樂(lè)類(lèi)型,我都有一個(gè)單獨(dú)的html頁(yè)面,但我只想擁有一個(gè)大的html頁(yè)面。我有可以使此功能起作用的Javascript代碼,但是我不確定如何編輯導(dǎo)航欄的內(nèi)容以使這種情況發(fā)生。這是我的javascript文件和導(dǎo)航欄,如下所示:我真的很感謝您的幫助    pages: [],    show: new Event('show'),    init: function(){        app.pages = document.querySelectorAll('.page');        app.pages.forEach((pg)=>{            pg.addEventListener('show', app.pageShown);        })        document.querySelectorAll('.nav-link').forEach((link)=>{            link.addEventListener('click', app.nav);        })        history.replaceState({}, 'Home', '#home');        window.addEventListener('popstate', app.poppin);    },    nav: function(ev){        ev.preventDefault();        let currentPage = ev.target.getAttribute('data-target');        document.querySelector('.active').classList.remove('active');        document.getElementById(currentPage).classList.add('active');        console.log(currentPage)        history.pushState({}, currentPage, `#${currentPage}`);        document.getElementById(currentPage).dispatchEvent(app.show);    },    pageShown: function(ev){        console.log('Page', ev.target.id, 'just shown');        let h1 = ev.target.querySelector('h1');        h1.classList.add('big')        setTimeout((h)=>{            h.classList.remove('big');        }, 1200, h1);    },    poppin: function(ev){        console.log(location.hash, 'popstate event');        let hash = location.hash.replace('#' ,'');        document.querySelector('.active').classList.remove('active');        document.getElementById(hash).classList.add('active');        console.log(hash)        //history.pushState({}, currentPage, `#${currentPage}`);        document.getElementById(hash).dispatchEvent(app.show);    }}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 183 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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