Consider marking event handler as ‘passive’ to make the page more responsive

I am using hammer for dragging and it is getting choppy when loading other stuff, as this warning message is telling me. Handling of ‘touchstart’ input event was delayed for X ms due to main thread being busy. Consider marking event handler as ‘passive’ to make the page more responsive. So I tried to add … Read more

How to add a simple jQuery script to WordPress?

First you need to write your script. In your theme folder create a folder called something like ‘js’. Create a file in that folder for your javascript. E.g. your-script.js. Add your jQuery script to that file (you don’t need <script> tags in a .js file). Here is an example of how your jQuery script (in wp-content/themes/your-theme/js/your-scrript.js) might … Read more

TypeError: ‘undefined’ is not a function (evaluating ‘$(document)’)

WordPress uses jQuery in noConflict mode by default. You need to reference it using jQuery as the variable name, not $, e.g. use [sourcecode language=”plain”]jQuery(document);[/sourcecode] [custom-related-posts title=”You may Also Like:” none_text=”None found” order_by=”title” order=”ASC”]

In WordPress How to Use jquery and $ Sign

By default when you enqueue jQuery in WordPress you must use jQuery, and $ is not used (this is for compatibility with other libraries). Your solution of wrapping it in function will work fine, or you can load jQuery some other way (but that’s probably not a good idea in WordPress). If you must use document.ready, you can actually pass $ into … Read more