Jump to content

Need to swap order of the section/blocks

Recommended Posts

  • Replies 2
  • Views 405
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Posted
On 2/3/2022 at 1:42 PM, kam_2kbk said:

Site URL: https://www.reklaimyours.com/browser-test

hey guys, so for the landing page, i was thinking to rearrange the order of text and image for 2nd section. Currently in mobile it shows 

text > image 
Image > Text 
Text > image 

Thanks! 

Try adding to Home > Settings > Advanced > Code injection, choose footer

<script>
  (function() {
    window.addEventListener('DOMContentLoaded', () => {
      const configId = 'section[data-section-id="61f1f6acb09f6979e06a4e81"]';
      const sectionConfig = document.querySelector(configId);
      const nextSectionConfig = document.querySelector(`${configId} + section`);
      if(sectionConfig && nextSectionConfig) {
        const copyConfigSection = nextSectionConfig.cloneNode(true);
        copyConfigSection.classList.add('mobile-section');
        sectionConfig.insertAdjacentElement('beforeBegin',copyConfigSection);
      }
    });
  })()
</script>

<style>
  @media only screen and (min-width: 768px) {
    .mobile-section {
      display: none;
    }
  }
  @media only screen and (max-width: 767px) {
    section[data-section-id="61f1f6acb09f6979e06a4e81"] + section {
      display: none;
    }
  }
  <style>

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

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.