In wordpress, to use $ instead of jQuery prefix, i added the following code around all js code:
jQuery(function($) {
...
});
It works well, but i cannot call an object from another javascript file, the following problem persists:
Slider is not defined
This is my code:
file1.js
jQuery(function($) {
var slider = new Slider();
});
file2.js
jQuery(function($) {
function Slider() {
this.nb_ele = 10;
}
});
It seems that because the workspace of two js files is different so they can't call function from another one. Any solution?