Ok, first what you will do is → fixing the bugs…
Replace your code with this one. Take a look onto CONSOLE.
$w.onReady(()=>{console.log("My page is ready!");
$w("#dynamicDataset").onReady(()=>{console.log("My Dataset is ready!");
let itemObj = $w("#dynamicDataset").getCurrentItem(); console.log("RESULTS: ", itemObj);
$w("#vectorImage3").onClick(()=>{console.log("Previous-Button clicked!");
$w("dynamicDataset").next()
.then((item)=> {console.log(item)})
// $w("Document").background.src="place_here_the_url_link_of_your_background_pic";})
.catch((err)=> {console.log(err);});
});
$w("#vectorImage2").onClick(()=>{console.log("Next-Button clicked!")
$w("dynamicDataset").previous()
.then((item)=> {console.log(item)})
// $w("Document").background.src="place_here_the_url_link_of_your_background_pic";})
.catch((err)=> {console.log(err);});
});
});
});
Do you still get ERRORS ?
And as i can understand —> “Fond” <— will be the DB-FIELD, for all your BACKGROUNDS, right?
If so then UPDATE the following lines in your CODE, or just copy and paste this one.
$w.onReady(()=>{console.log("My page is ready!");
$w("#dynamicDataset").onReady(()=>{console.log("My Dataset is ready!");
let itemObj = $w("#dynamicDataset").getCurrentItem(); console.log("RESULTS: ", itemObj);
$w("#vectorImage3").onClick(()=>{console.log("Previous-Button clicked!");
$w("dynamicDataset").next()
.then((item)=> {console.log(item);
$w("Document").background.src = item.fond;
}).catch((err)=> {console.log(err);});
});
$w("#vectorImage2").onClick(()=>{console.log("Next-Button clicked!")
$w("dynamicDataset").previous()
.then((item)=> {console.log(item);
$w("Document").background.src = item.fond;
}).catch((err)=> {console.log(err);});
});
});
});