Kpeterson1716 Posted May 7, 2020 Share Posted May 7, 2020 Hi there! Is there anyway to make a summary carousel autoplay in the adirondack template? Thanks in advance! -Kristen Link to comment
derricksrandomviews Posted May 7, 2020 Share Posted May 7, 2020 I read that this code works, its old so I am keeping my fingers crossed that it is still good. You place it in the advance code injection header of your summary page: script> Y.on('domready', function () { var galleries = Y.Squarespace.GalleryManager.getGalleries(); var duration = 4000; var gallery=galleries[0]; var carousel=gallery["gallery-design"]; var totalGroups=carousel.get('totalGroups'); var currentGroup=0 var container=gallery.get("container"); var nextBtn=Y.one(gallery.get("elements.next")._nodes[0]).on("click",function(e){ e.preventDefault(); e.stopPropagation(); advanceCarousel() }) var prevBtn=Y.one(gallery.get("elements.previous")._nodes[0]).on("click",function(e){ e.preventDefault(); e.stopPropagation(); backupCarousel() }) Y.one(container._node).get('parentNode').on("mouseover",function(){ clearInterval(myInterval) }) Y.one(container._node).get('parentNode').on("mouseout",function(){ clearInterval(myInterval) setMyInterval() }) var myInterval; function setMyInterval(){ myInterval = setInterval(function(){ advanceCarousel() },duration) } setMyInterval(); function advanceCarousel(){ if(currentGroup==(totalGroups-1)){ currentGroup=0; }else{ currentGroup++; } carousel.goToGroup(currentGroup); } function backupCarousel(){ if(currentGroup==0){ currentGroup=totalGroups-1 }else{ currentGroup--; } carousel.goToGroup(currentGroup); } }); </script> This one was created later, and I think I would try it first: Remember to add this to the page header code injection for the summury page OR the header code injection for the Index if it's in an Index. Also it may not work in preview. Try testing it from an incognito window in your browser. <script> Y.on('domready', function () { try { var container = Y.one("#reviews"); /*change this to the slug of your page*/ var gallery = Y.Squarespace.GalleryManager.getGalleryByContainer(container); gallery.setAttrs({ "autoplay":true, "autoplayOptions": { "timeout":9000, /*make this higher to decrease speed, lower to increase it*/ "randomize": true } }); } catch (e) { console.error("Could not configure Gallery autoplay.", e); } }); </script> Link to comment
Kpeterson1716 Posted May 8, 2020 Author Share Posted May 8, 2020 Thanks so much! So, it works when I am viewing the summary itself, but when I add the summary to a page it doesn't autoplay. Any suggestions? Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.