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 !