Custom javascript to block upwards scrolling doesn't seem to work

Hi!
I’m trying to use the code below on one of my pages but it simply doesn’t work.

The code: Edit fiddle - JSFiddle - Code Playground

The div id is “mydiv”, overflow is set to auto so i’m out of ideas. I tried using the embed snippet from fiddle and hosting it on dropbox (I use that with a parallax script and that works perfectly), but nothing.

Can anyone get this to work?