Jump to content

LFyel101

Circle Member
  • Posts

    10
  • Joined

  • Last visited

Everything posted by LFyel101

  1. Ok, nevermind, i've realised I can inject the script into the specific blog sections rather than the overall site!
  2. Site URL: https://parrot-hibiscus-33rc.squarespace.com Hi Folks, pw: homack101 I'm used a bit of code I found on here to prepend my blog pages with a "back to" link. However my site is going to be using multiple blogs, and I need the "back to" links to be different on them both. One is going back to a people section and one is for an actual blog. https://parrot-hibiscus-33rc.squarespace.com/people/blog-post-title-one-nnsty-hd5zl on this section I've got it working fine, however for this section, https://parrot-hibiscus-33rc.squarespace.com/blog/blog-post-title-one-238h5 I want it to say "Back to Insights" this is the code I am using... <script> jQuery(document).ready(function($) { $('<section id="back-to" class="Index-page"><div class="sqs-block-button button-block Index-page-content"><div class="sqs-block-button-container--center"><p class="sqsrte-small preFade fadeIn"><a href="/" class="sqs-block-">← Back to People</a></p></div></div></section>').insertBefore(".blog-item-top-wrapper"); }); </script> Is it possible to alter this so that it relates to the specific URLs, rather than just all blogs on the site? thanks! Laura
  3. Trying to create a counter for my slideshow gallery which changes number in relation to what image the slideshow is currently on. Initially had it working by creating a counter that changes when the arrows are clicked, but sometimes you can click the page and the image will not change (however the counter which detects the clicks will!) I wondered if anyone had any luck creating gallery pagination by getting the index of the image currently on display, however this level of javascript is a bit over my head. Any help would be greatly appreciated! If anyone had any plug ins to recommend rather than my own shonky javascript that would be greatly appreciated! I've created the counter by adding a code block below the image and inserting the following script. <p class="counter"></p> <script> let imageNumber = 1 const counter = document.querySelector("p.counter") const nextButton = document.querySelector("a.next") const prevButton = document.querySelector("a.previous") const image = document.querySelectorAll(".thumb-image").length const galleryContainer = document.querySelector(".sqs-block-gallery") const imageSingle = document.querySelector(".thumb-image") let newCurrent = imageSingle.tabIndex const updateSection = function (){ counter.innerHTML = `${imageNumber} / ${image}` } const nextFunction = function (){ imageNumber = imageNumber + 1 if ( imageNumber > image ) { imageNumber = 1 } } const prevFunction = function (){ imageNumber = imageNumber - 1 if ( imageNumber < 1 ) { imageNumber = image } } updateSection() nextButton.addEventListener("click", function (){ nextFunction() updateSection() }) imageSingle.addEventListener("click", function (){ nextFunction() updateSection() }) prevButton.addEventListener("click", function (){ prevFunction() updateSection() }) </script>
  4. Hi @tuanphan, Its injected into the site header but I can remove so you can have a proper look! thank you!
  5. <script> // Changes the format of date on summary items var myObj = document.getElementsByClassName('summary-metadata-item--date'); var options = { year: 'numeric', month: 'long', day: 'numeric'}; for (var i = 0; i < myObj.length; ++i) { var item = myObj[i]; var date = new Date(item.innerHTML); item.innerHTML = date.toLocaleDateString('en-GB', options); } </script> Hi Folks, Wondering if anyone can help, I've used the above code to get UK format dates on my summary blocks for events, but this doesn't work with events that have a date range rather than a single date. Wondering if anyone can help me get it working as its beyond my JS skills! It just shows "invalid date" for thumbnails that have an event spanning more than one date Any advice appreciated
×
×
  • 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.