jQuery scrollTop only works when DevTools is open in Edge

111 Views Asked by At

I have a weird problem... I'm just hoping someone will believe me.

I'm currently working with a platform called K2 where in a form I've injected some jQuery. The script is scrolling a list control to a specific element within that list and works without any problems in Chrome and in IE. But not in Edge (v16.16299), unless I have DevTools open.

This is the function. If I put an alert() before animate() I'm getting it, without having DevTools open... So I guess it has to do something with animate or scrollTop?

$(function() { jQuery.fn.scrollTo = function(elem) { $(this).animate({ scrollTop: $(this).scrollTop() - $(this).offset().top + $(elem).offset().top - 4 }, 500); return this; }; });

scrollTo is then called within a K2-rule):

$("#idOfParent").scrollTo("input[value='aValueImGetting'");

I'm clueless and the closest thing I've found is this, which didn't help me since I can't update Edge due to... stuff: Javascript in Edge only works with devtools open However, the last comment about this being solved from an update is from 2016, and my Edge version is from mid 2017?

0

There are 0 best solutions below