WordPress.org

Support

Support » Plugins and Hacks » [Plugin: JavaScript to Footer] Breaking the Nivo Slider

[Plugin: JavaScript to Footer] Breaking the Nivo Slider

Viewing 8 replies - 1 through 8 (of 8 total)
  • syrinx32123
    Member

    @syrinx32123

    please help!

    Sean Donovan
    Member

    @mrsdonovan

    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.

    syrinx32123
    Member

    @syrinx32123

    Hi Sean,

    Please let me know if you figure out a solution!

    Sean Donovan
    Member

    @mrsdonovan

    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.

    syrinx32123
    Member

    @syrinx32123

    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.

    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.

    syrinx32123
    Member

    @syrinx32123

    awesome, thanks for that

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: JavaScript to Footer] Breaking the Nivo Slider’ is closed to new replies.