[Resolved] Sticky navigation Jquery

Home Forums Support Sticky navigation Jquery

  • This topic has 4 replies, 2 voices, and was last updated 4 months ago by Elvin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1510172
    Martin

    Hello,

    I really love the sticky navigation and want to use it to get rid of any scroll to top functionality.
    Does the sticky navigation needs jquery for the first paint or only when I start scrolling?

    I am asking because I want to defer to by loading it from an external file right before </body> to make it load after picture/fonts etc.

    2. question is related as I want to improve loading speed of the “blog overview” page by actually adding the “lates blog posts” block two times on top of each other. I will only load one specific post in the upper one above the fold and the rest in the lower one below the fold. Is there a way to do this? Maybe use a hero and load the first blog post in the hero?

    best regards
    Martin

    #1510314
    Elvin
    Staff
    Customer Support

    Hi,

    Does the sticky navigation needs jquery for the first paint or only when I start scrolling?

    /sticky.min.js needs the jquery core library to load first for it to be able to reference it. Else, it will return an undefined reference error. It reads and adds the scroll eventlistener when the necessary DOM elements are loaded.

    I am asking because I want to defer to by loading it from an external file right before </body> to make it load after picture/fonts etc.

    The sequence is: jquery core loads first, DOM elements loads next (divs,a,p,h1,img etc) and then the sticky.min.js.

    If you inspect the DOM structure, jquery link is on the <head> while the sticky.min.js goes way far down after the footer right before </body>.

    While you can move the jQuery <link> right before sticky.min.js, I highly recommend not doing it because other plugins also use it which may cause issues if moved way far down the DOM loading sequence.

    2. question is related as I want to improve loading speed of the “blog overview” page by actually adding the “lates blog posts” block two times on top of each other. I will only load one specific post in the upper one above the fold and the rest in the lower one below the fold. Is there a way to do this? Maybe use a hero and load the first blog post in the hero?

    May I know why you have to hook multiple post list blocks?

    Tip: If you want to reduce the blog post list page to a certain number of posts, You can do that by going to Dashboard > Settings > Reading and change the “Blog pages show at most” value.

    But if you want something more complex like our very own Dispatch – https://gpsites.co/dispatch/ from the Site Library, consider using WP Show Posts plugin and hooks.

    A wise man once said:
    "Have you cleared your cache?"

    #1512404
    Martin

    Thank you for the fast reply.

    Ok then I am fine with jquery loading first after the html. Site is lightning fast anyway.

    best regards
    Martin

    #1512433
    Martin

    Topic solved for me!

    #1513724
    Elvin
    Staff
    Customer Support

    Topic solved for me!

    Nice one. 🙂 Glad to be of any help.

    A wise man once said:
    "Have you cleared your cache?"

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