Jump to content

crevice

Member
  • Posts

    8
  • Joined

  • Last visited

  1. Yes thanks for that, I've managed to get it working: window.addEventListener('DOMContentLoaded', () => { changeTarget = (link) => { link.setAttribute('target', '_self'); } const selector = '[href="https://www.johncervantes.co.uk/instagram"]'; const instaLink = document.querySelectorAll(selector); instaLink.forEach(changeTarget) }); And I'll wrap in the DOMContentLoaded if I need to add anything in the future.
  2. Thanks very much for this. Unfortunately it's still not working. The error given in console is "Uncaught TypeError: instaLink.setAttribute is not a function" So presumably it still can't find the element... Then I realised that querySelectorAll returns a NodeList of all the elements it finds? https://developer.mozilla.org/en-US/docs/Web/API/NodeList So I'll need to iterate over all of them. I'll think about this and try tomorrow.
  3. thanks for writing. No I don't need help with this anymore - I actually think it's likely to be a problem with the bandcamp player rather than Squarespace. I'm now embedding a Spotify player instead, which is working.
  4. Site URL: https://www.johncervantes.co.uk I've made my Instagram social link (found in the site header) actually point to a gallery page on my own website. I'd like for this link to open in the same tab. I'm just a hobbyist coder and have come up with in code injection. But it's not working - is it anything to do with when the code will run? <script> function changeTarget() { const instaLink = document.querySelectorAll('[href="https://www.johncervantes.co.uk/instagram"]'); instaLink.setAttribute("target", "_self"); } changeTarget(); </script>
  5. oh well actually I've decided to just use a different streaming platform for the embed - the iframe code for Spotify results in a responsive width, so no issues. I removed the uneccesary custom css. I think the problem I was having was that the div I set the min-width for was the child of a div that was set to 33.3% (4/12 columns). I could have added a min-width but that div didn't have an id, only classes... If I had wanted to target that div, how would I specify that particular one with custom css? But anyway my problem is solved.
  6. Site URL: https://www.johncervantes.co.uk/music/past I've embedded a Bandcamp music player using an html code block. It looks good on desktop and mobile, but with a screen size in between (iPad etc) the text on the right starts to cover the iframe. I tried to fix it by adding this custom css div#block-yui_3_17_2_1_1655199650584_9623 { min-width: 350px; } But that's not worked. Am I close? Does anyone know what I need to change. Thanks
  7. I was a hobbyist coder for a while and built my site using Gatbsy - based on React. The great thing about those was isolated REUSABLE COMPONENTS that can be pulled into a page wherever you want, multiple times over multiple pages if that's what you wanted. I couldn't keep up with the coding, so am using Squarespace. It does look fantastic simply using a template and ready-made styling. But this feature of building a page using REUSABLE COMPONENTS is sady missing! I want a section from one page (a list... each item has an image, a title, and a description) to also appear lower down on the home page. It's not very practical to have to edit in both places every time I want to make a change. (I'm using to list events.)
×
×
  • 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.