SWhales Posted April 26 Posted April 26 Hi there, I'm working on a site for a client and they've asked if we can have the image in the background on the portfolio automatically cycle through as though someone was hovering over the images (but still maintain the ability for a user to hover over the links and stop the rotating effect while they do so). Is there a simple way to do that? Hoffcg.squarespace.com/projects PW: HOFFsitedraft2024
tuanphan Posted April 28 Posted April 28 You try this code to Website > Website Tools > Code Injection > 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--> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
SWhales Posted April 30 Author Posted April 30 Hm, I popped that in the footer code injection but it doesn't seem to work.
catemiz Posted June 3 Posted June 3 On 4/30/2024 at 9:23 PM, SWhales said: Hm, I popped that in the footer code injection but it doesn't seem to work. This didn't work for me either. Did anyone find a solution for mobile?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment