社区文档构建进行中,欢迎编辑。社区答疑群(非官方):717421103,点点小课堂(腾讯会议):5696651544
Widget:测试/3
<script> function Bfolder(dom){ this.folder=dom this.inner=this.folder.getElementsByClassName("inner")[0] this.after=this.folder.getElementsByClassName("after")[0] let tmp=[] this.slide() tmp.push(this.inner.clientHeight) this.slide() tmp.push(this.inner.clientHeight) this.maxHeight=Math.max(...tmp) this.minHeight=Math.min(...tmp) if(this.maxHeight==this.minHeight){ this.after.style.display="none" } this.after.onclick=()=>{ this.slide() } } Bfolder.prototype.slide=function(){ this.folder.classList.toggle("spread") } Bfolder.initialize=function(){ let folders=document.getElementsByClassName("bfolder") for(let i=0;i<folders.length;i++){ new Bfolder(folders[i]) } } Bfolder.initialize() </script>