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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

單擊按鈕時按鈕打開并跳轉(zhuǎn)手風(fēng)琴

單擊按鈕時按鈕打開并跳轉(zhuǎn)手風(fēng)琴

倚天杖 2023-12-19 16:02:46
我其實之前問過這個問題,但我沒有得到我真正想要的。回到我的老話題適用于此網(wǎng)站:http://n-p-cain.com/schedule.html我希望,如果您點擊“日期” “事件菜單部分”中的按鈕您將跳轉(zhuǎn)到“事件列表”中的該日期并且還將打開手風(fēng)琴,現(xiàn)在手風(fēng)琴保持關(guān)閉狀態(tài)(如果我命名 class=“accordion-link1”或者如果您單擊“事件菜單”中的按鈕,手風(fēng)琴將打開,但您不會跳轉(zhuǎn)到它(如果我使用下面的代碼)。     var acc = document.getElementsByClassName("accordion");    var i;    for (i = 0; i < acc.length; i++) {      acc[i].onclick = function() {        this.classList.toggle("active");        var panel = this.nextElementSibling;        if (panel.style.maxHeight){          panel.style.maxHeight = null;        } else {          panel.style.maxHeight = panel.scrollHeight + "px";        }      }    }    // get list of links by class    var links = document.getElementsByClassName("accordion-link");    var linksLength = links.length;    for(var i=0; i < linksLength; i++){      links[i].onclick = function(e){        // preventDefault is probably optional        // depending on your application        e.preventDefault();        // isolate the hash        var hash = e.target.hash;        // remove # from hash        hash = hash.substring(1, hash.length);        // select by id using hash        document.getElementById(hash).click();      }    }   @charset "utf-8";/* CSS Document */ /* Style the buttons that are used to open and close the accordion panel */button.accordion {    background-color: #020725;    color: #FFF;  font-weight: bolder;    cursor: pointer;    padding: 10px;  margin: 0px 5px 0px 5px;    width: 98%;    text-align: left;    border: none;    outline: none;    transition: 0.4s;  border-radius: 5px;}/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */button.accordion.active, button.accordion:hover {    background-color: #132437;}/* Style the accordion panel. Note: hidden by default */div.panel {    padding: 1px;      margin-bottom: 5px;  background-color: #none;    max-height: 0px;    overflow: hidden;    transition: max-height 0.2s ease-out;}
查看完整描述

2 回答

?
白衣非少年

TA貢獻1155條經(jīng)驗 獲得超0個贊

我懷疑,當(dāng)您單擊其中一個日期鏈接時,它會抓取之前的哈希值已更改。



查看完整回答
反對 回復(fù) 2023-12-19
?
撒科打諢

TA貢獻1934條經(jīng)驗 獲得超2個贊

我認為如果您將 var hash = e.target.hash 更改為 var hash = window.location.hash 就會起作用。據(jù)我所知,點擊事件對象不會返回 target.hash。


    // get list of links by class

    var links = document.getElementsByClassName("accordion-link");


    var linksLength = links.length;

    for(var i=0; i < linksLength; i++){

      links[i].onclick = function(e){


        // isolate the hash

        var hash = window.location.hash;


        // remove # from hash

        hash = hash.substring(1, hash.length);


        // select by id using hash

        document.getElementById(hash).click();

      }

    }


查看完整回答
反對 回復(fù) 2023-12-19
  • 2 回答
  • 0 關(guān)注
  • 189 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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