Hi I have some very simple code for a gallery that changes two text items one for name and one for description.
The code works fine in preview but no matter what I do I cant get the live code to work.
I have tried creating a collection for the gallery on the front page and I have set the permissions to site content, I also tried custom permissions. I have gone over 10+ posts about this subject but the advice either doesnt apply or I have tried it.
I thought this would take 10 minuets but have spent 6 hours trying to get it right.
Im not the worlds greatest programmer but I am pretty sure this is how you do this.
// API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center
$w . onReady ( function () {
// Write your JavaScript here
// To select an element by ID use: $w('#elementID')
// Click 'Preview' to run your code
$w ( '#text41' ). text = $w ( '#gallery1' ). currentItem.description ,
$w ( '#text42' ). text = $w ( '#gallery1' ). currentItem.title
});
/**
- Adds an event handler that runs when a gallery’s current item changes.
Read more - @param {$w.GalleryItemChangedEvent} event
*/
export function gallery1_currentItemChanged ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
$w ( ‘#text41’ ). text = $w ( ‘#gallery1’ ). currentItem.description ,
$w ( ‘#text42’ ). text = $w ( ‘#gallery1’ ). currentItem.title
}