Site logo

[Resolved] slick Slider – where to place js in GP Hooks?

Home Forums Support [Resolved] slick Slider – where to place js in GP Hooks?

Home Forums Support slick Slider – where to place js in GP Hooks?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2097922
    Ema

    Hello, I’m wondering where the best place is to place Slick Slider’s CDN

    CSS in the head hook. But does JS go into the body or footer?

    CSS
    
    <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
    
    JS
    
    <script type="text/javascript" src="//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>

    Thanks in advance

    Ema

    #2098051
    David
    Staff
    Customer Support

    Hi there,

    it depends on how the Javascript is written as the code within the script may need to execute after some HTML is rendered on the page. Other scripts however do not.

    I would put in the wp_footer hook as it will run after the page has loaded and not interfere as much with the sites performance. If it works as expected then leave as is.

    If theres an issue eg. a Slider is badly displayed on initial load, then move it to the wp_head hook.

    #2102695
    Ema

    Thank you, David, Perfect. I’m playing with Swiper Slider now.

    #2102723
    David
    Staff
    Customer Support

    Awesome – glad to be of help!

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