Hello,
I am trying to give users an option to select which photo will be displayed as a first one in gallery. So when they click on a photo it splices and unshifts.
Here is my code so far:
export function gallery1_itemClicked ( event ) {
let items = $w ( “#gallery1” ). items ;
let item = event . item ;
let itemDescription = event . item . description ; // “Description”
let itemIndex = event . itemIndex ;
console . log ( itemIndex );
if ( itemIndex !== 0 ) {
items . splice ( itemIndex , 1 );
items . unshift ( item )
}
}
I get the index but code doesn’t perform.
Anyone build similar functionality?
Thanks!