I have an overlay module installed which allows my admin to open in an Overlay (Jquery Pop Up)

I want to run a specific JQuery code whenever admin page opens in an overlay. How can I do that?

1 Answer 1


Implement hook_overlay_child_initialize()


function YOURMODULE_overlay_child_initialize() {
  drupal_add_js(drupal_get_path('module', 'YOURMODULE') . '/YOURMODULE-overlay.js');


and in file YOURMODULE-overlay.js add:

(function ($) {
  Drupal.behaviors.YOURMODULE = {
    attach: function (context, settings) {
      // Your jQuery code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.