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
Altravista
9311 gold badge11 silver badges32 bronze badges
-
load the js after content load then check.Qaisar Satti– Qaisar Satti2017年10月25日 07:51:11 +00:00Commented Oct 25, 2017 at 7:51
-
just try with define([jquery','domReady!'] but it load before all why?Altravista– Altravista2017年10月25日 07:59:10 +00:00Commented Oct 25, 2017 at 7:59
1 Answer 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
Altravista
9311 gold badge11 silver badges32 bronze badges
-
Thanks so much! I was working for 2 days to resolve jQuery plugin. Thanks again.Dolly– Dolly2022年10月11日 15:40:48 +00:00Commented Oct 11, 2022 at 15:40
default