Page transition works only once after site publish

Hi! I’m creating my first page transition effect and have come across a problem I haven’t found a solution for in the forums. I’ve tried a couple of different code snippets, one from @pixelgeek and one from Tim Ricks (both included below). In both cases, the code will delay page transition the first time after site publish. On every subsequent click – no delay, it goes straight to the page. Any help out here on what I’m doing wrong? Here’s the code (I currently have T.Rick’s code installed):

pixelgeek’s:

Here’s my read-only:
https://preview.webflow.com/preview/chicagoideas?utm_medium=preview_link&utm_source=dashboard&utm_content=chicagoideas&preview=577ceded3fe9b14c9547fe10b781e5a3&mode=preview