Jump to content

Recommended Posts

  • Replies 7
  • Views 1.7k
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)

Try adding this code to Website > Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  var image = new Array ();
image[0] = "https://cdn.pixabay.com/photo/2023/10/27/12/13/vineyard-8345243_1280.jpg";
image[1] = "https://cdn.pixabay.com/photo/2023/10/28/18/02/songbird-8348139_1280.png";
image[2] = "https://cdn.pixabay.com/photo/2023/10/21/18/47/boat-8332114_1280.jpg";
image[3] = "https://cdn.pixabay.com/photo/2023/10/20/14/52/glacier-8329668_1280.jpg";
var size = image.length
var x = Math.floor(size*Math.random())

$('header#header img').attr('src',image[x]);
</script>

I got code from Codepen: https://codepen.io/fredthewebguy/pen/yvWddw

Edited by tuanphan

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.