There is excess whitespace, which according to the documentation on collapse should be completely free for leftover elements to take over. My code has nothing to do with this. I only made JavaScript functions which collapse buttons and images when a certain light - decoration combination is selected.
As shown in the video when I make certain combinations which collapse a button together with its accompanying image in the repeater it collapses, but the buttons DO NOT take over the whitespace that the collapsed elements left after them. This is both true inside of the repeater and when collapsing the container.
I will leave code showing how I collapse repeater nodes and containers below in case that helps
Collapsing container:
function toggleFold ( index ) {
// Set variables for the elements that correspond to specified index’s section.
let $fold = $w ( #option ${ *index* } Box
);
let $arrowDown = $w ( #arrowDown ${ *index* }
);
let $arrowUp = $w ( #arrowUp ${ *index* }
);
let $container = $w ( #container ${ *index* + 1 }
)
// If the specified section is currently collapsed:
if ( $fold . collapsed ) {
// Set its elements to the expanded state.
$fold . expand ();
$arrowDown . hide ();
$arrowUp . show ();
// If the specified section is currently expanded:
} else {
// Set its elements to the collapsed state.
$fold . collapse ();
$arrowDown . show ();
$arrowUp . hide ();
}
}
Collapsing repeater nodes:
function disabler ( repeaterName , secondaryIndexArray , buttonName , imageName , containerName ) {
console . log ( repeaterName )
$w ( repeaterName ). onItemReady ( ( $item , itemData , index ) => {
let n = secondaryIndexArray . includes ( index )
//console.log(secondaryIndexArray, index, n)
if ( n === true ) { // loop to find and disable dekor with index 2
let repeatedElement = $item ( buttonName );
let repeatedElement2 = $item ( imageName );
let repeatedElement3 = $item ( containerName )
repeatedElement3 . collapse ();
repeatedElement2 . collapse ();
repeatedElement . collapse ();
//repeatedElement2.hide();
checkForIncompatibleDekor ( secondaryIndexArray ) // resets decor if previous option isn’t compatible with it
}
else {
console . log ( “didn’t satisfy condition, looping forward…” )
}
})
//enabler()
}
In terms of what I tried to show with the video:
^ In this frame the last node shifts to the first place for some reason and leaves excess whitespace marked with blue, instead of going behind the silver node with index 2, since it has a index of 3
^Here the spacing gets messed up by collapsing one of the nodes, the row has enough space for 4 nodes as can be seen in the repeater above, again the spacing gets messed up and the last node doesn’t jump up a row to cover the free space
^This is how it should look when I collapse nodes, they should be evenly spaced out and in a single row if there is enough space. This only works because these nodes have indexes 0,1,2 meaning there are no collapsed nodes in between. If lets say node with index 1 was collapsed and node with index 3 expanded there would be excess whitespace leftover again
^In terms of containers this is how I intended for them to look while collapsed (Dekor container)
^But again when I collapse both of them the excess whitespace leftover from the top container expands them both…
Is there some way to also implement custom CSS files? I can’t figure out what to do about this in the wix editor