1

I'm trying to implement an owl-carousel in my Magento webshop. I've loaded the .js file and the stylesheet. Jquery is (I believe) loaded from the template. When I use to code to activate the carousel I get the following error:

Uncaught ReferenceError: jQuery is not defined 

I think it is caused by the fact that the owl carousel script is loaded before the jQuery. I'm loading the .js file from local.xml, but I have no idea where the jQuery is loaded.

When I look in the head of the page I can see the jQuery is loaded from:

skin/frontend/theme/template/js/lib/jquery-1.10.2.min.js

Does anybody know in which file the script is called? Or how I can make sure the jQuery is called before the .js?

Btw if I include the .js in head.phtml its still called before the jQuery

  • It might just be addJs by xml files ordered incorrectly – elibyy Sep 29 '14 at 10:45
2

Open the file skin/frontend/theme/template/js/lib/jquery-1.10.2.min.js and put this code at last

jQuery = jQuery.noConflict();

Now use jQuery instead of conventional $ sign in every place (In your carousel jquery code). This way you can avoid jquery conflict in Magento

  • I've follow your steps but it didn't work, I still get the same error. – user3164891 Sep 29 '14 at 8:54
  • put your carousel script here. you said you add jquery from template. If yes, put that code too. – Rajeev K Tomy Sep 29 '14 at 9:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.