Hi Geeks,
I want to achieve of Changing Page’s (Document’s) background image after Page got loaded.
My Default settings for Image Background in Wix Editor is,
Page Background Color is White.
And I did not connected with Database.
Here my Code is :
import wixData from ‘wix-data’ ;
$w . onReady ( async function () {
console . log ( "Now only i ready :)" );
// Getting Only the required Data from Database not all other details about database
**const** { items } = **await** wixData . query ( "PageBackgrounds" ). find ();
// Generating Randon Number Which will not cross the total count
**const** rnd = Math . floor ( Math . random () * items . length );
// Assigning Image to the Page(Document) background
$w ( "Document" ). background . src = items [ rnd ]. image ;
});
And Am not getting what i want
My Problem is :
Before OnReady function runs,
A image is Setting as background Automatically. Actually , I don’t know why?
Below video Will help us to understand the problem in Clear.
Thanks in Advance
–
Kottravai