December 16, 2013 at 12:50 am #200531
how to properly call JS right after jquery is loaded?
In Enfold theme I see in header that jquery is loaded first (wp-includes/js/jquery/jquery.js?ver=1.10.2), and second it’s loaded: wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1
How to call my JS (wp-content/themes/quince/js/jpreloader.js?ver=2.1) to be loaded just after jquery.js?
Currently it’s loaded after jquery-migrate.min.js…
Does anyone knows?
December 16, 2013 at 10:11 am #200614
- This topic was modified 4 months ago by bogosavljev.
I guess jquery and jquery migrate will always load together (since wp3.6) and you can’t load your script before the jquery migrate script. You can try this hack: http://aahacreative.com/2013/08/05/remove-jquery-migrate-wordpress-36/ to remove the migrate file and then enqueue it later. I wouldn’t recommend this hack though because many js scripts still depend on the migrate functions and you provoke js errors with this code change.
PeterDecember 16, 2013 at 11:52 am #200633December 16, 2013 at 12:35 pm #200638
I’m not familiar with the jpreloader script code but I’m pretty sure that it’s not a problem with the jquery migrate code because the migrate code just extends jquery with “deprecated” syntax/functions. The preloader code is optimized for jquery 1.7.1 which contained all “migrate” functions in the jquery core code and thus I’m not even sure if the jpreloader.js would work without the migrate script if you use the new jquery 1.10.x version which does not contain many of the old jquery 1.7.1 functions (like bind(), delegate(), etc.).
If you can’t get the jpreloader script to work I recommend to try another preloader script (I can’t recommend a specific script though because I never tested such a script with Enfold or another Kriesi theme) or try to hire someone here: http://www.microlancer.com/ or here: http://www.kriesi.at/contact/customization to implement the script for you.
PeterDecember 16, 2013 at 3:53 pm #200685December 16, 2013 at 3:58 pm #200688
The topic ‘How to call JS right after jquery in header?’ is closed to new replies.