How to make background Image change with every page load?

How is it possible to make photos (background) on a page, change on its own every time a user refreshes/ or revisits the website (at every page load)? I guess it possible with a dynamic page? Has anyone tried it before. I want to do it for my homepage, www.letsnapit.com

Thanks
Altaf

Hi,
Check out Document reference .
You can place it in onReady scope.
Roi.

Thanks Roi, I am a novice when it comes to WIX code. Can’t get my head around it. I would appreciate if you have a ready code which I can use. Also, i believe there should be a bank of images from where the code will pick a new image each time the page loads? Sorry if I sound too naive.

Hi,
Unfortunately we are not able to code this feature on your behalf,
Look at the example in the reference and place it in the onReady scope.
You can hire an expert in Wix Arena , or you can try to code it and consult about it here in the forum.
Roi.

This function was supposed to allow me achieve this goal, it actually works great when working in preview mode, but it does not work on published mode.

#dataset1 has 2 visible columns image and count. There are 8 rows with different images and count has numbers from 1 to 8. The image column from this dataset has been connected to #image54 and in the options I created a filter in which “count” is equal to variable “numero” from #dataset2.
#dataset2 is set on read & write, because we need to get the value “numero” from it, add a +1 to it, check that it never gets past 8, and then save it.

Check website: raiderslp .com/1

import wixData from ‘wix-data’ ;
//imported wixData just in case

$w . onReady ( function () {

$w ( "#dataset2" ). onReady ( () => { 
**let**  count  =  $w ( "#dataset2" ). getCurrentItem (); 
**let**  number1  =  count . numero ; 
**if**  ( number1  >  7 ) { 
    number1  =  0 ; 
} 
number1 ++; 

// up until here everything seems to be working just fine

$w ( "#dataset2" ). setFieldValue ( "numero" ,  number1 ); 
**return**  $w ( "#dataset2" ). save () 
. then (() => {    
     $w ( "#dataset2" ). refresh (); 
}) 

}); 
});