Random background images JS
-
Hello,
Is there a simple way to have a random background image on the Home page ?
I know it isn't a lay option but I guess it's something simple in javascript ? (but I don't know js so...)All I know is that it should begin like that :
(id:72 correspond to my landing page)<script> window.laytheme.on("newpageshown", function(layoutObj, type, obj){ if(type == "page" && obj.id == 72){ // Put all of your js, without document ready inside here } }); </script>So basically not much... And add a class in html.
I found a lot of different codes online like those :
http://jsfiddle.net/mrwigster/36cL6/https://fredthewebguy.me/tutorials/load-random-images-page-load-jquery/
but can't make them to work... And I don't know if I should write the paths to the images as a link "http://..." or "/media/img.jpg"
Sorry for my vague message. But it seems a lot of people would to add that to their land page so it would be nice to have an easy solution somewhere.
Thank you very much !
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login