/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Drupal.behaviors.themeNameSpace = function(){ /** * Set namespace */ var namespace = { /** * Initialise functions within the namespace */ init : function() { namespace.function1(); namespace.function2(); namespace.function3.fInit(); namespace.function4(); }, /** * function 1 */ function1 : function() { //code here }, /** * function 2 */ function2 : function() { //code here }, /** * function 3 */ function3 : { fInit : function() { //initialise function 3 namespace.function3.helperfunction1(); namespace.function3.helperfunction2(); }, helperfunction1 : function() { //code here }, helperfunction2 : function() { //code here } }, /** * function 4 */ function4 : function() { //code here } } //end of namespace /** * Initialise namespace */ namespace.init(); }