deedee2344 Posted July 26, 2022 Share Posted July 26, 2022 (edited) Client wanted number counters to showcase impact, but I had difficulty finding one that is: (a) free (b) simple to implement (c) responsive (d) easily customizable (add image, set animation duration, set animation on scroll/load, etc.), and (e) could easily accommodate different prefixes and suffixes for each number (for this last one, I found that lots of plugins are limited or inflexible in this sense). Ghost plugins has a paid number counter and, I bought it, only to find out that I need to create a blog page and use summary blocks, which are limiting creatively, and only lets me set either a prefix or suffix for all (I can't pick and choose for each number). Super annoying. So, after some searching, I found this code: https://nicepage.com/qt/41839/counter-synergy-design-squarespace-template. It's a bit of a hack, but it ended up working great and I wanted to share for anyone who's also looking. What I love about this one is that I can easily type "50%" or "49 Families" or "$7000" and the number counter will still work with any prefixes, suffixes, or other text that I add. See comments below for steps/code and gifs. Edited July 26, 2022 by deedee2344 Link to comment
Solution deedee2344 Posted July 26, 2022 Author Solution Share Posted July 26, 2022 1. Download the file package from: https://nicepage.com/qt/41839/counter-synergy-design-squarespace-template 2. Upload only nicepage.js into Squarespace. (Create a text link. Link the text to a file. Upload nicepage.js file. Delete the link. File is now uploaded to Squarespace's backend.) Note: This is where it's a bit of a hack bc I'm not well-versed in Javascript, so I just uploaded the entire .js file without editing. Others more knowledgeable might want to edit the .js file to only include the number counter code bit to cut down on webpage load times. 3. Under Settings > Advanced > Code Injection > Header, paste the following code: <!-- Installing Number Counter --> <script class="u-script" type="text/javascript" src="/s/nicepage.js" defer></script> 4. This is the HTML for one number. Add as a code block, which Squarespace will naturally make responsive if multiple code blocks/numbers are added in a row. Note: I love how I can just add any additional text in front of or after the number and the number counter will still work. See attached screenshots. Numbers are set to animate on "scroll," and animation duration is set to 3000, both of which can be further customized if need-be. <section id="carousel_9139"> <div style="text-align: center"> <!--Replace img link here--><img src="/s/counter1.png" alt=""> <h1 data-animation-name="counter" data-animation-event="scroll" data-animation-duration="3000" style="margin-top: 0; margin-bottom: 0;"> <!--Edit number here-->1,255 Customers </h1> <p class="sqsrte-large"> <!--Edit copy here-->Served Annually Through Education Programs </p> </div> </section> See attached video to see how it looks on two pages on my site: 1290494964_numbercounters.mov Link to comment
Iulian Posted October 13, 2022 Share Posted October 13, 2022 Hi, how did you download the file package? on the website you share I can only install the tool. tnx in advance Link to comment
Jackie123 Posted 2 hours ago Share Posted 2 hours ago Can I do this by downloading the html website from the online editor version or do I have to download the package and build from there? I followed the steps but the animation is not working. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment