Fancybox jQuery Conflict (2 posts)

  1. johpg
    Posted 2 years ago #

    I installed Fancybox (jQuery lightbox implementation) plugin on my site running the Highwind theme.

    The Fancybox would work, but theme's scroll-to-top link would not appear anymore.

    Turns out this is a jQuery conflict.

    Fancybox is loading jQuery AFTER it has already been loaded by Highwind.

    The Highwind implementation of jQuery uses the noConflict function, which is then removed/overwritten when the Fancybox jQuery is loaded.

    My solution:

    1. Delete the script tag that loads jQuery for Fancybox. This means that Fancybox is now using the jQuery loaded by Highwind.
    2. In my javascript block that calls the Fancybox, replace "$" with "jQuery". I made 2 replacements.

    Now the Fancybox works and the scroll-to-top appears and works.

    It appears that by using "noConflict" in your version of jQuery, any other plugin loading jQuery will break theme functions such as scroll-to-top.

    Have you implemented jQuery in the theme correctly?

  2. James Koster
    Theme Author

    Posted 2 years ago #

    Have you implemented jQuery in the theme correctly?

    Yes. Highwind loads WordPress' native jQuery version via the dependency argument in wp_enqueue_script(). Are you sure the plugin is enqueing jQuery correctly?

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic