- This topic has 11 replies, 2 voices, and was last updated 3 years, 9 months ago by David.
-
AuthorPosts
-
July 9, 2020 at 3:09 am #1357618Mouse
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.
July 9, 2020 at 6:32 am #1357858DavidStaffCustomer SupportHi there,
why not just leave Autoptimize to do what it is doing? That is inlining it in the footer.
July 9, 2020 at 7:10 am #1357893MouseYes 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.
July 9, 2020 at 7:25 am #1357901DavidStaffCustomer SupportThere 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.
July 9, 2020 at 9:24 am #1358186MouseIs 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.
July 9, 2020 at 9:34 am #1358191DavidStaffCustomer SupportIt’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.July 9, 2020 at 9:47 am #1358203Mousesorry… 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?
July 9, 2020 at 9:49 am #1358204MouseWe can maybe do a fixed navigation bar altogether? That can be a solution right…or will that use jquerry too?
July 9, 2020 at 9:57 am #1358216MouseSimply 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?
July 9, 2020 at 11:19 am #1358286MouseOkay 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
July 9, 2020 at 11:48 am #1358303MouseThis looks like another topic… let me reopen it thanks.
July 10, 2020 at 1:32 am #1358748DavidStaffCustomer SupportOK thanks
-
AuthorPosts
- You must be logged in to reply to this topic.