Hallo Fabian,
Du überschreibst lastOpenedBoxHeight mit der aktuellen Höhe (height) während das Schließinterval noch läuft.
> lastOpenedBox = box;
> z = height;
z = lastOpenedBoxHeight;
> lastOpenedBoxHeight = height;
> lastOpenedBoxHeight = lastOpenedBoxHeight - 3;
z = z - 3 oder kurz z-=3
> if( lastOpenedBoxHeight <= 0) {
z <=0
100%ig sicher bin ich jetzt nicht. Ohne Test ist es schwierig. Aber versuch es mal.
Gruß, Jürgen