`每当我展开嵌套的可折叠项时,其父级的可见性都不会正确计算。屏幕上遗漏了一些嵌套的内容
这是处理滚动高度的 html 代码和 js 代码
// Get all collapsible buttons
const collapsibles = document.getElementsByClassName('collapsible');
// Add click event listener for each collapsible
for (let i = 0; i < collapsibles.length; i++) {
collapsibles[i].addEventListener('click', function() {
this.classList.toggle('active');
const content = this.nextElementSibling;
if (content.style.maxHeight) {
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + 'px';
}
// Get all nested collapsible buttons within this collapsible
const nestedCollapsibles = content.getElementsByClassName('nested-collapsible');
// Loop through nested collapsibles and expand or collapse them accordingly
for (let j = 0; j < nestedCollapsibles.length; j++) {
const nestedContent = nestedCollapsibles[j].nextElementSibling;
if (this.classList.contains('active')) {
if (!nestedContent.style.maxHeight) {
nestedContent.style.maxHeight = nestedContent.scrollHeight + 'px';
content.style.maxHeight = (parseInt(content.style.maxHeight) + nestedContent.scrollHeight) + 'px'; // Add nested collapsible's scroll height to parent collapsible's scroll height
} else {
nestedContent.style.maxHeight = null;
content.style.maxHeight = (parseInt(content.style.maxHeight) - nestedContent.scrollHeight) + 'px'; // Subtract nested collapsible's scroll height from parent collapsible's scroll height
}
}
}
});
}
.active {
color:blue;
}
```Fantastic League
![]()
A 2D Top Down Shooter game which heavily focuses on Enemy AI. I have made an attempt to build this project from ground up. I have used SFML for rendering shapes and textures, the rest is made from scratch. The project involves the integration of complex enemy AI. A simple Data-Oriented Design approach has been followed in this project for handling different events and messages by the enemies.
Got a lot of contribution
1. This process involves the development and integration of states like Game Menu, Splash Screen, InGame, Game Over etc states. These states are fetched with delta time which is calculated from the Game Loop. 2. This stage also includes the development of Asset Manager, Input Manager etc
1. This process involves the development and integration of states like Game Menu, Splash Screen, InGame, Game Over etc states. These states are fetched with delta time which is calculated from the Game Loop. 2. This stage also includes the development of Asset Manager, Input Manager etc
1. This process involves the development and integration of states like Game Menu, Splash Screen, InGame, Game Over etc states. These states are fetched with delta time which is calculated from the Game Loop. 2. This stage also includes the development of Asset Manager, Input Manager etc
我需要计算方面的帮助以及影响可见性的原因
我希望所有嵌套都是独立的,并且每当展开时它们都会增加父级可见性的高度 这里最后一个嵌套被剪掉:
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号