listen foundation toggler in JS



我有一个关闭按钮使用基础Toggler

https://get.foundation/sites/docs/toggler.html

如何在JS我可以做一些DOM当关闭按钮被点击?

我试过这样做:

function handleToggler() {
console.log('closing the panel');
}
window.addEventListener(
'on.zf.toggler',
handleToggler,
);

但这不是它。

你可以添加一个onclick到html:

<a data-toggle="menuBar" onclick="yourFunctionHere()">Expand!</a>

然后访问你想在函数中做某事的DOM节点:

function yourFunctionHere(e){
const a_div = document.getElementById("a_div");
}

最新更新