I was wondering if someone could help me with this, I have set up some repeaters with expanding/collapsing boxes. I have set them up so that opening the boxes of one section closes the open boxes of the other sections, and scrolls to the top of that section - 100px to account for my header.
My problem is - when the buttons trigger the collapse of boxes in the section above the one I need the box to open in, it seems to affect the position of the anchor. Probably my code is bad (I am learning as I am going), but this is how I have it set up for now:
$w('#systemsrepeater, #toprepeater, #bottomrepeater').forEachItem(( $item, itemData, index) => {
$item('#SODbutton').onClick(() => {
$item('#PPCbox, #EDRbox, #btdbox, #lmdbox, #citbox, #tmbox').collapse(), $item('#SODbox').expand(), $item('#systemsanchor').scrollTo();
})
$item('#EDRbutton').onClick(() => {
$item('#PPCbox, #SODbox, #btdbox, #lmdbox, #citbox, #tmbox').collapse(), $item('#EDRbox').expand(), $item('#systemsanchor').scrollTo();
})
$item('#PPCbutton').onClick(() => {
$item('#SODbox, #EDRbox, #btdbox, #lmdbox, #citbox, #tmbox').collapse(), $item('#PPCbox').expand(), $item('#systemsanchor').scrollTo();
})
$item('#btdbutton').onClick(() => {
$item('#SODbox, #EDRbox, #PPCbox, #lmdbox, #citbox, #tmbox').collapse(), $item('#btdbox').expand(), $item('#serviceanchor').scrollTo();
})
$item('#lmdbutton').onClick(() => {
$item('#SODbox, #EDRbox, #btdbox, #PPCbox, #citbox, #tmbox').collapse(), $item('#lmdbox').expand(), $item('#serviceanchor').scrollTo();
})
$item('#citbutton').onClick(() => {
$item('#SODbox, #EDRbox, #btdbox, #PPCbox, #lmdbox, #tmbox').collapse(), $item('#citbox').expand(),$item('#serviceanchor2').scrollTo();
})
$item('#tmbutton').onClick(() => {
$item('#SODbox, #EDRbox, #btdbox, #PPCbox, #lmdbox, #citbox').collapse(), $item('#tmbox').expand(), $item('#serviceanchor2').scrollTo();
})
$item('#closesod, #closeppc, #closeedr').onClick(() => {
$item('#SODbox, #EDRbox, #PPCbox').collapse();
})
$item('#closeb, #closel, #closec, #closet').onClick(() => {
$item('#btdbox, #lmdbox, #citbox, #tmbox').collapse(), $item('#serviceanchor').scrollTo();
})
})
}
I am also sure that there is a much simpler way of programming this! If anyone can help out that would be much appreciated