1

I have add a custom.js file under my_child theme folder web/js/custom.js

here is code

define([
  "jquery"
], 
function($) {
        "use strict";

        $('#shipping').find('.step-title').click(function(){

          //Expand or collapse this panel
          $(this).next().slideToggle('fast');

          //Hide the other panels
          $(".step-content").not($(this).next()).slideUp('fast');

        });

        console.log('My log');
});

I have create requirejs-config.js

var config = {
  deps: [
    "js/custom"
  ]
};

'My log' is print on console but jquery accordion does not works. If i copy and past custom.js function on browser console it works fine

website is in developer mode how can i debug?

2
  • load the js after content load then check. Oct 25, 2017 at 7:51
  • just try with define([jquery','domReady!'] but it load before all why?
    – Altravista
    Oct 25, 2017 at 7:59

1 Answer 1

1

solved in this way. thanks to Lucas

define([
  'jquery','rjsResolver'
], 
function($, resolver) {
        "use strict";

        resolver( function (){
            $('#shipping').find('.step-title').click(function(){

          //Expand or collapse this panel
          $(this).next().slideToggle('fast');

          //Hide the other panels
          $(".step-content").not($(this).next()).slideUp('fast');

        });

        console.log('Accordion Eseguito');      
    });
});
1
  • Thanks so much! I was working for 2 days to resolve jQuery plugin. Thanks again.
    – Dolly
    Oct 11 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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