CRM-16795 - Fix z-index conflict btw WP admin bar and popups
authorColeman Watts <coleman@civicrm.org>
Fri, 3 Jul 2015 13:28:41 +0000 (09:28 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 3 Jul 2015 13:28:41 +0000 (09:28 -0400)
CRM/Utils/System/WordPress.php
js/crm.wordpress.js [new file with mode: 0644]

index 35739d2e4f94b0fde21dc79ad3db7cb14f2d2cb2..277eda2472d3989885452847ab6de044288b9300 100644 (file)
@@ -627,4 +627,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     }
   }
 
+  /**
+   * Append WP js to coreResourcesList.
+   */
+  public function appendCoreResources(&$list) {
+    $list[] = 'js/crm.wordpress.js';
+  }
+
 }
diff --git a/js/crm.wordpress.js b/js/crm.wordpress.js
new file mode 100644 (file)
index 0000000..6ca4ff5
--- /dev/null
@@ -0,0 +1,14 @@
+// http://civicrm.org/licensing
+CRM.$(function($) {
+  $(document)
+    .on('dialogopen', function(e) {
+      // Make admin bar hide behind popup windows
+      $('#adminmenuwrap').css('z-index', '100');
+    })
+    .on('dialogclose', function(e) {
+      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
+        // Restore admin bar position
+        $('#adminmenuwrap').css('z-index', '');
+      }
+    });
+});