WordPress.org

Ready to get started?Download WordPress

Forums

JavaScript to Footer
Breaking the Nivo Slider (9 posts)

  1. syrinx32123
    Member
    Posted 1 year ago #

    Is there a way to use this plugin without breaking the Nivo slider?

    http://wordpress.org/extend/plugins/footer-javascript/

  2. syrinx32123
    Member
    Posted 1 year ago #

    please help!

  3. Sean Donovan
    Member
    Posted 1 year ago #

    This is likely because some initialization javascript for the Nivo slider is loading in the middle of the page. Unfortunately, this usually requires a modification of the Nivo plugin.

    Even moving the initialization javascript to the footer might not work because it might have to fire *after* jquery, but *before* the nivo script. I'm having that problem with the Anything slider and moving the scripts to the footer.

  4. syrinx32123
    Member
    Posted 1 year ago #

    Hi Sean,

    Please let me know if you figure out a solution!

  5. Sean Donovan
    Member
    Posted 1 year ago #

    I got it work and then quickly reverted back. Now mind you, my solution below doesn't apply to Nivo Slider, but I am guessing the problem might be similar in that Nivo is loading some jQuery variables right after the slider is put in the page, but the jQuery isn't loaded until the bottom of the page.

    You have two options, both require editing the plugin -

    • Don't load the Nivo initialization stuff until the document has loaded (but using straight javascript) or,
    • Loads the Nivo initialization after jQuery.

    I got mine to work but I didn't like the result because my menus looked like crap until the jQuery fired. In my case, I actually liked the delay caused by loading the javascript because then the page rendered correctly from the start.

    In the end, I have gone with a CDN (Cloudflare) which makes the biggest difference.

  6. syrinx32123
    Member
    Posted 1 year ago #

    Hi Sean,

    I'm a bit of a newb. Can you explain what jQuery is? I imagine it has something to do with Javascript.

    I manually moved all JS from the header to the footer and it works fine for me now.

  7. 416BC
    Member
    Posted 1 year ago #

    I know this is old, but quick tip. This broke the sliders on my website too, all I had to do was add jquery in the header of my website.

    To do this, go to the template editor, find the header template, and find the </head> tag. Just above that, make an empty line, and paste the following.

    <script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>

    I know this isn't the best way to do this since jquery is now loading twice, and possibly different versions, but in my case, it worked fine. Test it out yourself, and if it doesn't work, simply remove it.

  8. syrinx32123
    Member
    Posted 1 year ago #

    awesome, thanks for that

  9. 416BC
    Member
    Posted 1 year ago #

    You're welcome. I hope it helps other too!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic