[Resolved] Jguerry Size too high

Home Forums Support [Resolved] Jguerry Size too high

Home Forums Support Jguerry Size too high

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1357618
    Mouse

    I ve optimized my website when it comes to speed.

    But there is still one issue. Jquerry.
    Now there are options to load them in the footer.
    Like by adding this…

    /** Remove jQuery scripts from begining */
    add_action(‘wp_enqueue_scripts’, ‘wbxp_script_remove_header’);
    function wbxp_script_remove_header() {
    wp_deregister_script( ‘jquery’ );
    }

    /** Load jQuery script at the end */
    add_action(‘genesis_after_footer’, ‘wbxp_script_add_body’);
    function wbxp_script_add_body() {
    wp_register_script( ‘jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js’, false, null);
    wp_enqueue_script( ‘jquery’);
    }

    But this breaks the sticky navigation. The sticky navigation part goes away. Is there a way to keep things working while loading the jquery at the end?

    If you check out any link with ?ao_noptimize=1 added at the end… you can see that the size of …jquery/jquery.js?ver=1.12.4-wp …. is over 30kb.

    If this problem solves all my pages become lesser than 100 kb and the speed increases drastically. Please tell me if I have any other options. Waiting for your reply anxiously.

    #1357858
    David
    Staff
    Customer Support

    Hi there,

    why not just leave Autoptimize to do what it is doing? That is inlining it in the footer.

    #1357893
    Mouse

    Yes but I am having this issue with Bing webmastertools that the page size is too big. Their recommended page size is 125kb and when I use the script as shown above… it reduces the page size drastically.. the website does not break of anything..except for the sticky navigation bar… it does not work anymore… Can you please let me know if there is anything we can do about it.

    #1357901
    David
    Staff
    Customer Support

    There are two parts to that script.
    1. Dequeue jQuery – which is working.
    2. Enqueue jQuery in footer – which is not working.

    Which means using that script jQuery is not being loaded. Which is why the Sticky Navigation doesn’t work.

    If you simply want to remove jQuery then disable the Sticky Nav. Its the only part of GP that requires jQuery.

    #1358186
    Mouse

    Is there a way to make a sticky slider without jquery…. or lazy loading of the sticky slider? Some work way around this problem. Because you have to understand. It really helps a lot when it comes to speed.

    Please help me with this.

    #1358191
    David
    Staff
    Customer Support

    It’s quite simple. If you do not want to load jQuery then you need to do 2 things:

    1. Disable Sticky Navigation in Customizer > Sticky Navigation.
    2. Do not use any plugins that require jQuery.

    Sticky Slider – I am not sure what you mean ?
    If you’re looking for Slider Plugins most of them use jQuery.

    #1358203
    Mouse

    sorry… I meant is there a way to use sticky nav and not use jquery at the same time? Or is there a way to lazy load the sticky navigation later on at the end?

    #1358204
    Mouse

    We can maybe do a fixed navigation bar altogether? That can be a solution right…or will that use jquerry too?

    #1358216
    Mouse

    Simply put, I don’t want jquery to load and want to use sticky navigation at the same time. Please let me know if there is a way I can do this with this theme?

    #1358286
    Mouse

    Okay I have been researching and I think I may have found a solution to this

    From here…

    https://generatepress.com/forums/topic/sticky-navigation-5/

    #site-navigation {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    }
    .header-wrap {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    }

    But when I add this… The navigation bar is not sticky on mobile devices and the color of the sticky slider is transparent.. I have set it up on brw.info … have a look at it please and let me know

    #1358303
    Mouse

    This looks like another topic… let me reopen it thanks.

    #1358748
    David
    Staff
    Customer Support

    OK thanks

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.