Random Sorting / Code Help

Hey @Waldo! Two questions here I’m hoping you or someone else can help with

I tried implementing the solution you described to achieve random sorting on every page refresh, but it still doesn’t appear to be working for me.

The preview link is below, and the page in question is titled “Finden”. I’ve limited the items to 1 item, and it’s currently on random sort, and I’ve added the custom code before the /body tag for the page. Any ideas why it isn’t working? Does it have anything to do with the fact that I’ve limited it to only show 1 item?

https://preview.webflow.com/preview/cosmoneo?preview=2669ae13f072c4b49edc38a8e3842e25

Second, I’ve got a page with iframe content in an HTML embed, but the iframe content seems to be hiding the footer below it. When the iframe isn’t on the page, the footer displays perfectly (and it displays in the Webflow designer all the time). Any idea why this would be happening? The preview link is the same as above, and the page with the iframe is “FindenApp”. Thanks in advance!

You cannot put code in the head of the page without a ready function. You can also move the scripts to the footer code.

@jordanshotwell it looks like you’re trying to use that random sort on refresh hack on a dynamic list which also has a Sort Order of “Random, Shuffle” setup on as well as limited to only display 1 list item. The little sorting hack doesn’t perform any calls to the server (like our sorting feature does), so it’s not able to make a call to the server, pick a random database item and display it on the site. But it can change the order of dynamic list items in a dynamic list (for now at least, I’m not sure if this custom code will work later on if we make any changes to how dynamic lists are displayed in the future). I also tested it on this side and it looks like the scripts for your external scripts from Shopify load in slowly which causes a pretty laggy effect for the sorting hack above :confused: could account for that with some sort of load screen on the page if you’d like?

You could try removing those random sort and limit settings and try this work around of setting your dynamic list wrapper to be set to overflow: hidden with a max height of say 450px or so for desktop, 350px on tablet and maybe just set the height back to auto on mobile as most folks like to scroll through listings rather than hiding them on mobile (as it’s difficult to use that overflow style hack).

Though my recommendation would be to just display all of the list items and either use the random sort feature or custom code sort hack and include a loading screen to account for any latency.

As for the other question, I’m not seeing the footer get cut off by the iframe? What browser are you seeing that occur in?