Jump to content

CALLINGALLCARS

Member
  • Posts

    5
  • Joined

  • Last visited

CALLINGALLCARS's Achievements

  1. tuanphan - So this did not work. What did work, kinda, is the JS you sent me from codpen : function changeBg() { var backgrounds = ["https://images.unsplash.com/photo-1502741338009-cac2772e18bc?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80", "https://images.unsplash.com/photo-1498557850523-fd3d118b962e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80", "https://images.unsplash.com/photo-1566400628146-ae8f27849e90?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2100&q=80"]; var imgShown = document.body.style.backgroundImage; var newNumber = Math.floor(Math.random()*backgrounds.length); document.body.style.background = 'url('+backgrounds[newNumber]+')'; } window.onload = changeBg; When I mean "kinda worked", the images previewed in "Safe Mode" while editing the page in Squarespace. Once I saved the page, logged out and opened it in another browser there was nothing where the code block is located. I did check to make sure that Javascript is working. Again, I thank you for your time and help!
  2. YES!!! Exactly like that...but not the background, yet in a code block. The idea is to rotate "banner ads" in a specific code block on a page. Thank you again for your help!!
  3. tuanohan– YES, the code block. I dropped in the code in the Code Block, but it remains blank. I left the settings for the Code Block as HTML, per Squarespace knowledge page. Thank you for your help!!
  4. here is the link, password is "wtd": https://chameleon-maroon-jfnd.squarespace.com/what-to-do-about
  5. Good afternoon everyone! So at my wits end with this one and i'm sure it is something simple I am overlooking. I am trying to get multiple images to change (or rotate out) with each page refresh within a code block. I have the Business account, so I should be able to use Javascript within the Code Block (BTW, I have also tried this in an Embed Block as well. Thank you in advance for any help that will lead to this functioning correctly!! Here is my code: <script type="text/javascript"> var total_images = 2; var random_number = Math.floor((Math.random()*total_images)); var random_img = new Array(); random_img[0] = '<a href="https://www.countrytonitepf.com/"><img src="'https://images.squarespace-cdn.com/content/v1/64a3fe63e840fa06e8ea1393/1690544840309-GJ8ZT0P51F8T6W403BVX/CountryTonite2.jpg' class="img-fluid" alt="Country Tonite link"></a>'; random_img[1] = '<a href="https://www.grabsomenuts.com/"><img src="'https://images.squarespace-cdn.com/content/v1/64a3fe63e840fa06e8ea1393/be9ae718-0ccb-4e41-b020-8e666edc6591/TryMyNuts-banner.jpg' class="img-fluid" alt="Try My Nuts link"></a>'; document.write(random_img[random_number]); </script>
×
×
  • 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.