• Resolved yeahfree

    (@yeahfree)


    because the inline javascript code is being executed apparantly already before the jquery.js has been loaded i’m receiving an error:
    Uncaught referenceError: jQuery is not defined

    besides from that, i would prefer this code not to be inline, as i’m running my sites on http/2, which makes it load on every page refresh. if it would be in a separate file it could be cached, and also be stored on a cdn for better performance. also on http/1.1 this could be beneficial, as all javascript could be minified and stored into 1 file on a cdn.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, if jQuery has not been loaded before the inline code, that probably means your theme or another plugin is forcing the jquery library to a (much) later time than usual. To move the inline code to an even later point, there is the option “FancyBox script priority” in the Theme & plugins compatibility section on Settings > Media.

    Set it to 99 and try again.

    Thread Starter yeahfree

    (@yeahfree)

    Hi RavanH, thanks for the quick response, putting it on 99 worked.

    Now i only have the second part of my questions left, can the current inline javascript also be placed in a file instead of as inline code?

    No, the inline script is dynamic (depends on your settings on Settings > Media) so it cannot live in a static file…

    Thread Starter yeahfree

    (@yeahfree)

    ok i understand. it could be written to a file, since it will only change whenever changes would be made in the settings, but i guess that’s out of the scope for this plugin to implement.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘inlining the javascript gives jquery error’ is closed to new replies.