我想用下拉菜單製作一個基礎網站。is-dropdown-submenu-parent使鏈接在Opera和Chrome上不可點擊
不過,我注意到,當我點擊一些鏈接有控制檯
Uncaught TypeError: t.getBoundingClientRect is not a function
at i (catalog-list-pack-d7c9d20e63.js:4) at Object.e [as ImNotTouchingYou] (catalog-list-pack-d7c9d20e63.js:4) at e.value (catalog-list-pack-d7c9d20e63.js:5) at HTMLLIElement.s (catalog-list-pack-d7c9d20e63.js:5) at HTMLLIElement.dispatch (catalog-list-pack-d7c9d20e63.js:2) at HTMLLIElement.y.handle (catalog-list-pack-d7c9d20e63.js:2)
此代碼,打破從基礎插件上的錯誤。
我的調試讓我得出結論,如果我刪除類is-dropdown-submenu-parent
一切工作正常。
這個課程來自於基礎課,恐怕我會在其他地方插入錯誤,因爲我不明白髮生了什麼。
另一件事 - 它不適用於Chrome和Opera。它適用於Mozzila甚至微軟邊緣(在新的Internet Explorer)
這裏是下拉是如何創建的
<div class="MegaMenu__row">
<div class="MegaMenu__listColumn">
<dt class="is-dropdown-submenu-parent MegaMenu__item MegaMenu__item--
header MegaMenu__item--no-bullet">
<a href="/somewhere</a>
</dt>
和下面是更多的聯繫,其工作的代碼。
關於打破其最小化插件,並從中取得一切的代碼是棘手的,但這裏是打破的功能。我試圖讓它更具可讀性,我不知道Dave是誰。
function f(t,e) {
if(t=t.length?t[0]:t,t===window||t===document)
throw new Error("I'm sorry, Dave. I'm afraid I can't do that.");
var f=t.getBoundingClientRect(),
o=t.parentNode.getBoundingClientRect(),
i=document.body.getBoundingClientRect(),
s=window.pageYOffset,
h=window.pageXOffset;
return{
width:f.width,
height:f.height,
offset:{top:f.top+s,left:f.left+h},
parentDims:{
width: o.width,
height: o.height,
offset{
top:o.top+s,
left:o.left+h
}
},
windowDims:{
width:i.width,
height:i.height,
offset:{
top:s,
left:h
}
}
}
}
有人可以向我解釋爲什麼這個js函數在Opera和Chrome上破壞了嗎?
你有沒有想過這個? – JuanR
不......我只是想「不會修復那個」。現在不是我的問題 –