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):


Here’s my read-only: