diff --git a/core/misc/tableheader.js b/core/misc/tableheader.js
index 0d4f7cd..68b9204 100644
--- a/core/misc/tableheader.js
+++ b/core/misc/tableheader.js
@@ -35,6 +35,12 @@ function tableHeaderResizeHandler(e) {
   forTables('recalculateSticky');
 }
 
+function tableHeaderViewportResizeHandler(e) {
+  TableHeader.computeOffsetTop();
+  forTables('recalculateSticky');
+  forTables('onScroll');
+}
+
 function tableHeaderOnScrollHandler(e) {
   forTables('onScroll');
 }
@@ -68,7 +74,12 @@ $(document).on({
   /**
    * Offset value vas changed by a third party script.
    */
-  'offsettopchange.TableHeader': tableHeaderOffsetChangeHandler
+  'offsettopchange.TableHeader': tableHeaderOffsetChangeHandler,
+
+  /**
+   * Recalculate TableHeader.topOffset when viewport is resized
+   */
+  'drupalViewportOffsetChange.TableHeader': tableHeaderViewportResizeHandler
 });
 
 /**
@@ -129,17 +140,11 @@ $.extend(TableHeader, {
   offsetTop: 0,
 
   /**
-   * Sum all [data-offset-top] values and cache it.
+   * Get offsetTop from displace object
    */
   computeOffsetTop: function () {
-    var $offsets = $('[data-offset-top]');
-    var value, sum = 0;
-    for (var i = 0, il = $offsets.length; i < il; i++) {
-      value = parseInt($offsets[i].getAttribute('data-offset-top'), 10);
-      sum += !isNaN(value) ? value : 0;
-    }
-    this.offsetTop = sum;
-    return sum;
+    this.offsetTop = Drupal.displace.getOffsets(true).top;
+    return this.offsetTop;
   }
 });
 
@@ -248,7 +253,6 @@ $.extend(TableHeader.prototype, {
     this.tableHeight = this.$originalTable[0].clientHeight;
 
     // Update offset top.
-    TableHeader.computeOffsetTop();
     this.tableOffset = this.$originalTable.offset();
     this.stickyPosition(TableHeader.offsetTop);
 
diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index caf9336..390ebd6 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -34,6 +34,10 @@ Drupal.behaviors.overlayParent = {
       return;
     }
 
+    // The overlay's positioning can be affected by other elements on the page.
+    // Get the current viewpor offset values.
+    Drupal.overlay.viewportOffsets = Drupal.displace.getOffsets(true);
+
     $(document)
       // Instead of binding a click event handler to every link we bind one to
       // the document and only handle events that bubble up. This allows other
@@ -131,6 +135,7 @@ Drupal.overlay.create = function () {
   $(window)
     .bind('resize' + eventClass, $.proxy(this, 'eventhandlerOuterResize'));
   $(document)
+    .on('drupalViewportOffsetChange' + eventClass, $.proxy(this, 'eventhandlerViewportOffsetChange'))
     .bind('drupalOverlayLoad' + eventClass, $.proxy(this, 'eventhandlerOuterResize'))
     .bind('drupalOverlayReady' + eventClass +
           ' drupalOverlayClose' + eventClass, $.proxy(this, 'eventhandlerSyncURLFragment'))
@@ -398,6 +403,14 @@ Drupal.overlay.isExternalLink = function (url) {
 };
 
 /**
+ *
+ */
+Drupal.overlay.eventhandlerViewportOffsetChange = function (event, offsets) {
+  Drupal.overlay.viewportOffsets = offsets;
+  Drupal.overlay.eventhandlerOuterResize();
+}
+
+/**
  * Event handler: resizes overlay according to the size of the parent window.
  *
  * @param event
@@ -435,15 +448,13 @@ Drupal.overlay.eventhandlerAlterDisplacedElements = function (event) {
     return;
   }
 
+  var offsets = Drupal.overlay.viewportOffsets;
+
   $(this.iframeWindow.document.body).css({
-    marginTop: Drupal.overlay.getDisplacement('top'),
-    marginBottom: Drupal.overlay.getDisplacement('bottom')
-  }).attr('data-offset-top', Drupal.overlay.getDisplacement('top'));
-
-  $(document).bind('offsettopchange', function () {
-    var iframeDocument = Drupal.overlay.iframeWindow.document;
-    $(iframeDocument.body).attr('data-offset-top', Drupal.overlay.getDisplacement('top'));
-    $(iframeDocument).trigger('offsettopchange');
+    'margin-top': offsets.top,
+    'margin-right': offsets.right,
+    'margin-bottom': offsets.bottom,
+    'margin-left': offsets.left
   });
 
   var documentHeight = this.iframeWindow.document.body.clientHeight;
diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module
index cc29255..197d006 100644
--- a/core/modules/overlay/overlay.module
+++ b/core/modules/overlay/overlay.module
@@ -225,6 +225,7 @@ function overlay_library_info() {
       array('system', 'jquery'),
       array('system', 'drupal'),
       array('system', 'drupalSettings'),
+      array('system', 'drupal.displace'),
       array('system', 'jquery.ui.core'),
       array('system', 'jquery.bbq'),
     ),
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 30317e4..0ad0c0c 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1380,6 +1380,21 @@ function system_library_info() {
     ),
   );
 
+  // A utility that measures elements like the toolbar that can potentially
+  // displace the positioning of display elements like the overlay.
+  $libraries['drupal.displace'] = array(
+    'title' => 'Drupal displace',
+    'version' => VERSION,
+    'js' => array(
+      'core/misc/displace.js' => array('group' => JS_LIBRARY),
+    ),
+    'dependencies' => array(
+      array('system', 'jquery'),
+      array('system', 'drupal'),
+      array('system', 'drupal.debounce'),
+    ),
+  );
+
   // A utility function to limit calls to a function with a given time.
   $libraries['drupal.debounce'] = array(
     'title' => 'Drupal debounce',
@@ -2076,6 +2091,7 @@ function system_library_info() {
       array('system', 'drupal'),
       array('system', 'drupalSettings'),
       array('system', 'jquery.once'),
+      array('system', 'drupal.displace'),
     ),
   );
   $libraries['drupal.timezone'] = array(
diff --git a/core/modules/toolbar/css/toolbar.base.css b/core/modules/toolbar/css/toolbar.base.css
index 58a2c2b..64e6468 100644
--- a/core/modules/toolbar/css/toolbar.base.css
+++ b/core/modules/toolbar/css/toolbar.base.css
@@ -91,7 +91,7 @@ html.js .toolbar {
   position: absolute;
 }
 .toolbar .tray {
-  z-index: 250;
+  z-index: 1200;
 }
 .toolbar .horizontal {
   width: 100%;
diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js
index 45e91ad..dc476ce 100644
--- a/core/modules/toolbar/js/toolbar.js
+++ b/core/modules/toolbar/js/toolbar.js
@@ -192,8 +192,17 @@ Drupal.toolbar.setHeight = function () {
     $toolbar.attr('data-offset-top', height);
     // Alter the padding on the top of the body element.
     $('body').css('padding-top', height);
-    $(document).trigger('offsettopchange', height);
-    $(window).trigger('resize');
+    Drupal.displace();
+  }
+};
+
+Drupal.toolbar.setTrayWidth = function () {
+  var $tray = $toolbar.find('.tray.active.vertical');
+  var trayWidth = $tray.width();
+  var offset = parseInt($tray.attr('data-offset-left'), 10);
+  if (offset !== trayWidth) {
+    $tray.attr('data-offset-left', trayWidth);
+    Drupal.displace();
   }
 };
 
@@ -296,6 +305,8 @@ function updatePeripherals () {
   setBodyState();
   // Adjust the height of the toolbar.
   Drupal.toolbar.setHeight();
+  // Adjust the tray width for vertical trays.
+  Drupal.toolbar.setTrayWidth();
 }
 
 /**
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index e4996bc..3292242 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -93,7 +93,7 @@ function toolbar_element_info() {
       'id' => 'toolbar-administration',
       // The 'overlay-displace-top' class pushes the overlay down, so it appears
       // below the toolbar.
-      'class' => array('toolbar', 'overlay-displace-top'),
+      'class' => array('toolbar',),
       'role' => 'navigation',
     ),
     // Metadata for the administration bar.
@@ -101,7 +101,7 @@ function toolbar_element_info() {
       '#heading' => t('Toolbar items'),
       '#attributes' => array(
         'id' => 'toolbar-bar',
-        'class' => array('bar', 'overlay-displace-top', 'clearfix'),
+        'class' => array('bar', 'clearfix'),
       ),
     ),
   );
@@ -631,6 +631,7 @@ function toolbar_library_info() {
       array('system', 'matchmedia'),
       array('system', 'jquery.once'),
       array('system', 'drupal.debounce'),
+      array('system', 'drupal.displace'),
       array('toolbar', 'toolbar.menu'),
     ),
   );
