0

i am on the way to create a custom module for sliding. But always its driving me crazy on jquery issues. Sometime the js will load and everything will be fine. After sometime, jquery wont get loaded.

var config = {
map: {
    '*': {
             'flexslider': 'Slidermodule_Mymodule/js/jquery.flexslider-min'
    }
} };

and the script looks like

require([ 'jquery', 'flexslider', 'domReady!'], function(){   jQuery(document).ready(function () {
jQuery('.flexslider').flexslider();  });  });

Some time there is no error. Sometime there is error on refresh. Please advise.

1 Answer 1

2

The flexslider plugin doesn't use an AMD pattern, so you'll have to use a 'shim' to guarantee jQuery as a dependency.

Take a look at Alan Storm's excellent article, he has a whole section dedication to "RequireJS and jQuery Plugins": Alan Storm: Magento 2 and RequireJS

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.