i'm using this Javascript Code to close the SideNav:
$('.button-collapse').sideNav({
closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
}
);
For the SideNav it works fine but after closing the SideNav the Overlay is still there. Cause Javascript of Materialize will create the element
<div id="sidenav-overlay" style="opacity: 1;" class=""></div>
It would be great if could get a fast solution. thank you
答案 0 :(得分:0)
可能你错过了一些在这里运作良好的东西www.jsfiddle.net/cuxzdkzr /
答案 1 :(得分:0)
SideNav背后出现多个叠加层的原因是因为在同一元素上多次运行实体化$('.button-collapse').sideNav()
。
快速解决此问题是在重新初始化materialize的sideNav之前从元素中删除所有先前的click()
个事件,如下所示:
$(".button-collapse").off('click').sideNav({ --yourOptions-- });