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?

asked Oct 25, 2017 at 7:36
2
  • load the js after content load then check. Commented Oct 25, 2017 at 7:51
  • just try with define([jquery','domReady!'] but it load before all why? Commented 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'); 
 });
});
answered Oct 25, 2017 at 10:36
1
  • Thanks so much! I was working for 2 days to resolve jQuery plugin. Thanks again. Commented Oct 11, 2022 at 15:40

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.