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.

asked Mar 2, 2016 at 11:53

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

answered Mar 2, 2016 at 13:09
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.