Hello,
I’d like to know if it is possible to add slides to a slideshow using Wix Code.
My use case : I use data recovered from a 3rd party web service and I don’t know in advance how many slides will be showed because my client will choose that from an Android application. He could set 3, 7, 10 slides. Of course I can limit the number of slides and code my web service accordingly.
But before putting a limit to the number of slides and say to my client: ‘Hey buddy, sorry, we need to choose in advance how many slides you can use on your website’, I’d like to understand if there’s a way to have N slides and add them trough Wix Code.
I’m already able to change the slides image with Wix Code.
I checked the Api references and there’s nothing there (at least I couldn’t find it).
I was hoping to do something like similar to what I’ve done when adding new pictures to a gallery (working):
let items = $w("#gallery1").items;
for (var i = 0; i < propertyBundle.lenght ; i++) {
items.push( {
"src": propertyBundleOrderdByDate[i].pictureArrayList[0].pictureURL,
"title": propertyBundleOrderdByDate[i].property.title,
"description": propertyBundleOrderdByDate[i].property.shortDesc,
"link": "/property-details?propertyId=" + propertyBundleOrderdByDate[i].property.propertyID + "&previousPage=home"
});
}
$w("#gallery1").items = items;
So I tried:
let slides = $w("#slideshow1").slides;
for (var j = 0; j < propertyBundle.length; j++) {
slides.push( {
"id": j,
" src": propertyBundle[j].pictureArrayList[0].pictureURL,
"name": propertyBundle[j].property.title,
});
}
$w("#slideshow1").slides = slides;
but I got the following error:
Unhandled promise rejection TypeError: setting getter-only property “slides”
Please, give me a hint if this can be accomplished.