Jump to content

Code not working with Ajax loading

Recommended Posts

Site URL: https://mommytomom.com/

Hi everyone. I would like to enable Ajax loading on my site but it doesn't work with my social sharing buttons and code I use on a few pages. I am not very knowledgeable with coding so I wanted to ask here if there is anything I can do. Is there a code you can add that makes the page refresh each time? I disabled Ajax for now but can turn it back on to troubleshoot if needed. The social buttons I'm referring to are through Shareaholic, they only show up if you refresh the page.  Thanks in advance for any help :)

Code injection

<!-- BEGIN SHAREAHOLIC CODE -->
<link rel="preload" href="https://cdn.shareaholic.net/assets/pub/shareaholic.js" as="script" />
<meta name="shareaholic:site_id" content="73ca7139ab230a40546bce24cbe1c713" />
<script data-cfasync="false" async src="https://cdn.shareaholic.net/assets/pub/shareaholic.js"></script>
<!-- END SHAREAHOLIC CODE -->

The other code I'm referring to I only have on my secondary navigation pages that I want to look like landing pages. It removes the header and footer. https://mommytomom.com/want-to-work-from-home

Pages settings, advanced 

<style>
     .Header, .Footer, .Mobile-bar, .Mobile-bar--top, .sqs-announcement-bar-custom-location{
     display:none !important;
     }
 </style>

Link to comment
  • Replies 3
  • Views 1k
  • Created
  • Last Reply
  • 1 month later...

Hey @Alice31302,

I have the same problem on a brine template.
What I am doing now, as I want to keep the Ajax loading on is instead of putting the css on in page header code injection, I target the page collection ID and add my code to custom css.

So something like that:

#collection-5ee62abcf25ac108a926be69{  
.Header, .Footer, .Mobile-bar, .Mobile-bar--top, .sqs-announcement-bar-custom-location{
     display:none !important;
     }
}

Works for me as I'm Inverting the logo color on different pages, or customising the index navigation to show specific items.

hope it helps, It's not a solution to code injection thingy with ajax but a good workaround.

Best,
Fabien

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.