Hey!
So, I’m trying to build Advertisement Banners. That 1 Advertisement banner I want to be able to have more than 1 Ad in their, so on refreshing the page it’ll change with the URL.
So ive created a CMS collection and input the image + URL for each sub cat.
However, I have to limit to 1 as i only want to show 1 at a time,
The sorting to random is 12hr cache so this is an issue.
I can across another post which gave a code to change on refresh which works well, but only if your showing all items (or more than 1)
Here’s the code: <script> var cards = $(".banner-item"); for(var i = 0; i < cards.length; i++){ var target = Math.floor(Math.random() * cards.length -1) + 1; var target2 = Math.floor(Math.random() * cards.length -1) +1; cards.eq(target).before(cards.eq(target2)); } </script>
So my issue now is, show 1 item at a time but on refresh it changes to a different one under the same CMS collection.
Thanks in advance.