JS hover direction-aware effect on button Codepen not working in Bricks

You can see the codepen version here that works flawlessly there: https://codepen.io/soum13/pen/eYrqBVg

But in Bricks there are two issues,

  1. It can only detect hover from the bottom of the button. If you hover at the top left or right corner, it still fills in from the bottom. That doesn’t happen in my codepen.

  2. When two of these buttons are placed in the same page in bricks then the 2nd one doesn’t work.

Just to see if this is builder specific or not, I tried this in E Pro (absolutely didn’t even work which I expected) but I then tried this on Oxygen and it’s working fine there. Two buttons on the same page works fine. However, it’s not completely working as when I hover from top left or right corner then it fills in from the middle right or left - so it’s definitely much better than what’s happening on bricks but not flawless either like in codepen.

Can anyone make this work for me in Bricks?