Modify the Javascript. Use the example and advice in comment 7 of the Project Application.

So your code would look more like:

(function ($) {

/**
 * TODO: This is an example:
 * Provide the toggle features for the custom_add_block_jquery
 */
Drupal.behaviors.customAddBlockJquery = {

  attach: function(context, settings) {
    $('#block-custom-add-block-custom-add-block-jquery').once('custom_add_block', function () {
      // When site loaded, hide the Popupbox First
    [...The rest of your JS code and logic should be here...]
  }
}

})(jQuery);

You will have to try to figure out what to do with your functions, how they could be declared and how you could rework slightly your JS code, but I guess this would simply require a little bit more testing.

Comments

willisiw’s picture

Behaviors are implemented.

willisiw’s picture

Status: Active » Fixed

Automatically closed -- issue fixed for 2 weeks with no activity.