Beyondspace Posted October 5, 2022 Share Posted October 5, 2022 (edited) Hi friends, In some questions on forum, I find out that many members need to automatically change the background on the portfolio collection page (currently, client needs to hover the item to make background change). Today, I share my code to work around with this feature. So here we go: - Final result we approach: beyondPortfolio.mp4 - Version: Squarespace 7.1 - Requirement: Javascript code (you will need at least the business plan to run javascript). - Installation: 1. Access: Home > Settings > Advanced > Code injection 2. Add the following code on footer <!--beyondspace autoplay Hover Portfolio start--> <script> (function(){ window.addEventListener('load', () => { beyAutoPlayPortfolio(3000); // change the speed of transition }); })() function beyAutoPlayPortfolio(e){let t=document.querySelectorAll(".portfolio-hover-items-list > li");if(t.length>1){let o=new Event("mouseenter"),l=null,r=function(){let i=document.querySelector('.portfolio-hover-item[data-active="true"]').closest("li").nextElementSibling;i||(i=t[0]),i.querySelector("a").dispatchEvent(o),l=setTimeout(r,e)};r(),t.forEach(e=>{e.querySelector("a").addEventListener("mouseenter",function(e){e.isTrusted&&clearTimeout(l)}),e.querySelector("a").addEventListener("mouseleave",function(e){e.isTrusted&&r()})})}} </script> <!--beyondspace autoplay Hover Portfolio end--> 3. Check your result Hope it can help Support me by some comments or pressing 👍 if this useful for you Edited October 5, 2022 by bangank36 RGCreative, diegphoto and tuanphan 2 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
robinphoto Posted September 27, 2023 Share Posted September 27, 2023 Hi, is there a way to make this work for the mobile version as well? Thanks! Link to comment
RGCreative Posted January 29 Share Posted January 29 Hi, This is working great on desktop - thank you! As above, looking for the same solution for mobile. Any help with this much appreciated. Link to comment
catemiz Posted June 3 Share Posted June 3 On 1/29/2024 at 9:59 PM, RGCreative said: Hi, This is working great on desktop - thank you! As above, looking for the same solution for mobile. Any help with this much appreciated. Yes I'm dying to learn how to use this on just mobile! 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