stickThis is not a function
-
Hi,
I have a problem with your plugin, where it’s throwing
Uncaught TypeError: $(...).stickThis is not a function
.I have skimmed through the support threads and you suggest that it’s a jQuery duplication issue. Which is not the case in my scenario, I am definitely loading 1 instance of the latest stable jQuery release v3.5.1 (maybe that’s the problem? cos WP loads a very outdated jQuery by default, which I have disabled due to security concerns).
So it has to be something else..
Just to let you know, everything on my website is minified & combined, some things are also deferred. Except for jQuery – it loads independently, without any delay or deferral.
And every other plugin is happy with that setup. So not sure what’s going on here.
Is there a simple solution to this?
On a related note, I was wondering if you could add a new option to your plugin’s Advanced tab, where a user could specify a custom JS Event trigger for
stickThis
function?For example, on my site I’ve created my own custom on “ready” event, which simply uses vanilla JS to wait, until jQuery is actually loaded/ready and then triggers my custom “actuallyReady” event.
So all of my custom independent scripts are triggered by that event. So, for example, instead of the typical:
(function($, document) { $(document).ready(function($) {}); })(jQuery);
I call this instead:
(function($, document) { $(document).on('actuallyReady', function() {}); })(jQuery);
It’s really handy, because my “actuallyReady” does some other logic sometimes, like wait for Oxygen Builder or Divi Builder to finish loading, if I am on a builder page (or not trigger the event at all, if I am on a page, which will break if JS is instantiated).
So it could be very useful for advanced users to have the ability to trigger your
stickThis
using a custom JS Event. And in this case, it will also prevent the race condition for jQuery, wherestickThis
clearly doesn’t wait long enough, before launching itself and then complains that jQuery is not ready yet.Regards,
Alex
- The topic ‘stickThis is not a function’ is closed to new replies.