0
我有一個mdl-layout__tab欄,在導航欄中有幾個鏈接。我希望這些鏈接觸發頁面滾動到頁面的各個部分。材料設計精簡版:mdl-layout__tab-欄和頁面滾動
我曾嘗試以下解決方案:
# the targeted section starts with the <a name="myTargetedSection" id="myTargetedSection"></a> tag
<div class="mdl-layout__tab-bar">
<a href="#myTargetedSection" class="mdl-layout__tab is-active">My link</a>
...
</div>
這不起作用,而且也不
<div class="mdl-layout__tab-bar">
<a href="#myTargetedSection" class="mdl-layout__tab" onclick="elmnt = document.getElementById('myTargetedSection'); scrollTo(document.body, elmnt.offsetTop, 600);">My link</a>
...
</div>
看來,MDL-layout__tab鏈接只能用MDL-layout__tab面板元件的工作。我發現的(不滿意的)解決方案是使用常規的mdl-navigation__link鏈接,但這些鏈接沒有底部邊界,並且不能在小屏幕上進行水平瀏覽。
有什麼想法?謝謝!