Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #200531

    Hello,

    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?

    • This topic was modified 10 years, 3 months ago by bogosavljev.
    #200614

    Hey 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.

    Cheers!
    Peter

    #200633
    This reply has been marked as private.
    #200638

    Hey!

    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://kriesi.at/contact/customization to implement the script for you.

    Best regards,
    Peter

    #200685
    This reply has been marked as private.
    #200688

    Hi!

    Tbh I don’t think it’s a theme issue but you just need to implement the script properly. But it’s up to you – if the boilerplate framework gives you better results for your project then use it :)

    Regards,
    Peter

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to call JS right after jquery in header?’ is closed to new replies.