0

I am working on a site made in Magento and I need to add my own jQuery. The problem is, the site already contains a plugin (ig lightbox2) that uses its own version of jQuery (1.6.2).

So I have added jQuery 1.11 and my script file to the footer and set it up like this:

$.noConflict();
jQuery( document ).ready(function( $ ) {

//Script Here

}); //End of No Conflict

However this causes parts of the Lightbox plugin to stop working with the error:

jQuery.easing[jQuery.easing.def] is not a function.

Is there a way to add my jQuery 1.11 without affecting the plugin?

Edit: I have changed the plugin settings to not use easing and it avoids the problem, and I can keep my scripts in the footer. However for future reference, if I were to put my scripts first in the head how would I make them work properly?

This is an example of the preloaded js I am working around:

<script type="text/javascript" src="http://www.example.com.au/skin/js/prototype/prototype.js,/js/lib/ccard.js,/js/prototype/validation.js,/js/scriptaculous/builder.js,/js/scriptaculous/effects.js,/js/scriptaculous/dragdrop.js,/js/scriptaculous/controls.js,/js/scriptaculous/slider.js,/js/varien/js.js,/js/varien/form.js,/js/varien/menu.js,/js/mage/translate.js,/js/mage/cookies.js,/js/varien/product.js,/js/varien/configurable.js,/js/calendar/calendar.js,/js/calendar/calendar-setup.js,/js/esl/jquery-1.8.3.min.js,/js/esl/no_conflict.js,/skin/frontend/default/default/esl/custom_option_variations/js/select_variation.js,/skin/frontend/base/default/ig_lightbox2/js/jquery-1.6.2.min.js,/skin/frontend/base/default/ig_lightbox2/lightbox/js/jquery.lightbox-0.5.pack.js" ></script>
user500665
  • 1,220
  • 1
  • 12
  • 38
  • I am sure you have already checked this, but just in case: http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page – Alp Jan 23 '17 at 22:51
  • you should know where to put the `noConflict()`, by just putting inside your body or head section without knowing where your plugin lightbox is called, that would be a problem. Just think that `noConflict()` will put your the above jquery instance in silent for the below code to prevent a conflict – Roljhon Jan 23 '17 at 22:54
  • @Alp The answer there requires the earlier version to be noConflict as well. I want to know if I can add my new script without changing what is already there. – user500665 Jan 23 '17 at 22:55
  • `$.noConflict(true)(function ($) { /* 1.11 code here */ });` – Kevin B Jan 23 '17 at 23:00

1 Answers1

0

If I remember correctly, you should be loading the noConflict-version first. So in your case, put 1.11 in the header, with the noConflict-script, before 1.6.2 and the lightbox scripts. That, I think, should work.