3

Ok, first of all, I know how to do this manually.
I could just download easing, place it in my plugin folder and load it using wp_enqueue_script. However, I want to load my script in a long-term way, ensuring that I use the same version of the easing script wordpress uses.

So what I am looking for, is a way to load easing in wordpress using wp_enqueue_script, as seen below. I have looked at the function reference for wp_enqueue_script, but I can't seem to find the right file/handle to enqueue. Is there anyone who knows how to load the WordPress-native easing script?

//I know this works because I've used it a thousand times already
wp_enqueue_script("jquery");

//I want something like this without having to use my own script
wp_enqueue_script("jquery-easing");
  • If the file isn't listed there in the list of available files, then it isn't included with WordPress. – Milo Jul 29 '13 at 18:25
  • 1
    Wordpress has no easing script included. See the list of scripts included in wp you will not foud easing. If you don't trust codex, you can look into the folder wp-includes/js and search jor easing script. – gmazzap Jul 29 '13 at 18:26
  • I had no idea the js files were in wp-includes folder. Learned something new today, thank you! If you post your answer I'll accept it. – Michiel Standaert Jul 29 '13 at 18:34
7

If you refer to this script, this is not included in wordpress. See the codex for list of scripts included in wp you will not find it.

If you don't trust codex, you can look into the folder wp-includes/js and search for easing script... it's not there.

Edit (additional info)

Answer above just 'strictly' respond to the OP question, because the plugin he want to include actually is not a standard wordpress script. However, as @Johannes Pille noticed in his answer, jQuery UI Effects that is a standard wordpress script that can be enqueued using wp_enqueue_script("jquery-effects-core"), contains easing functions. This easing function was introduced by jquery team independently from the plugin mentioned by OP. In old version of jquery ui the easings available were less than now (I can't remember in which version all easing has been introduced) and to use some advanced easings it was necessary using the mentioned plugin. When jquery team insert all now available easing, plugin developer update and rename his plugin easing functions to be compatible with jquery ui ones (all are implementation of Rober Planner equations). So, if someone has scripts that rely on the old-named plugin function must use the plugin, preferably the compatibility version). If old names are not requested, standard wordpress jquery-effects-core can be used as well.

Please also notice that the plugin script minified is less than 4kb, jquery-effects-core minified is 12.76 kb, so if effect is not needed including the plugin is probably better. On the other side, including the plugin and jquery ui effects does not make sense (unless, again, there are scripts that rely on old-named plugin easing function).

2

I am not 100% certain, but as far as I know, the easings are part of jQuery-UI Effects.

And hence should be loaded when enqueueing jquery-effects-core...

  • Yes, or 'sort of'. The plugin OP refers in previous version had different names for easing, that now (version 1.3) are changed to jquery ui effect standard easing names. But if you have script that rely on old easing names you need the plugin. Moreover, the plugin file minified is less than 4 Kb, effects core minified is 12.76 kb, so if you don't need effects... @Johannes Pille – gmazzap Jul 29 '13 at 20:46
  • 2
    It was not my intention to discredit your answer, @G.M. Simply added this for the sake of completeness. As you might have guessed from the fact that I mentioned not being certain, the further information you just provided was not known to me at all. Nevertheless, the statement "Wordpress has no easing script included" does not exactly hold true either. Also, the OP mentions wanting to "use the same version [...] WordPress uses". Proposal: Add both the existence of the option to use jquery-effects-core as well as your comment's contents into your answer - you'd have my upvote for sure. – Johannes Pille Jul 29 '13 at 21:46
  • Hi @Johannes Pille, I did not think you wanted to discredit my answer, I also reply to your comment for the sake of completeness. And following your suggestion I've edited my answer. – gmazzap Jul 29 '13 at 22:15
  • 1
    It seems that the easing is indeed in there. Thanks for your answer! ;) – Michiel Standaert Jul 31 '13 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.