Hello, I am new on Corvid and I am not familiar with programming!
Anyway I am trying to set the background of my page as it changes everytime i refresh the page.
I found this script and I (think I) linked with a database I called ‘RandomImages’ (Pic.1)
I tried to see the other open topics but I cannot go further then this.
When I preview it the standard background appears (as if the script doesn’t work) and after few seconds the background turns into white. Also it appear the text '‘WIX code SDK Warning: the url parameter that is passed to the BackgroundImageURL method cannot be set to null or undefined’ ’ That’s it. If anybody could give me a tip would be amazing.
Also, I would like that the background image will fill the page and be positioned to the center.
Many thanks in advance -
Piercarlo
So it looks like you are using Yisrael’s Random Image example as shown in this previous forum post here.
https://www.wix.com/corvid/forum/community-discussion/random-pic-homepage
So you need to change your field to suit your setup and not just copy it without changing it for your needs.
Note that the code line here…
$w('#image1').src = items[rnd].image;
…Is getting the image from the image field as shown in the pics below.


Ooohh thanks a lot! Now it’s working correctly!
Yes I learn from Yisrael’s Random Image example!
Just one little question If I can, I set everything on the mobile web so if I open it from the smartphone is correct, is there any chance to set the desktop version with its own database? The idea would be to have vertical photos for the mobile and horizontal for the desktop
Thanks, thanks a lot
I’m kinda new myself, butbifbi’m correct evrything edited in mobile editor has no effect in desktop.
So if you add 2 columns in your dataset (1 with vertical and 1 with horizontal images) you can select the vertical to show in mobile
Kristof.
Dear GOS thanks a lot for your help,
I tried to follow the tutorial but seems that as soon as I am editing the background I have not an element which I can hide as in the step .1
Am I wrong or Is there any other way to do it? Basically I donnow how to open the Popeties of the background element.
Thanks a lot
Piercarlo
It does work, however you need to use it as stated in the Wix API Reference.
https://www.wix.com/corvid/reference/$w.Document.html
So it would be like this.

GOS thanks again for your patience, but I am on the right way 
I did it like this, and it seems it is working.
On the mobile works correct with the vertical background,
Also on the desktop preview works correct with the orizontal images;
but when I publish it and I open the website from the browser on the desktop it is just a white background.
Last tips?
Thank you very much anyway