Changeset 38972
- Timestamp:
- 10/26/2016 10:37:35 PM (8 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/css/customize-preview.css
r38967 r38972 93 93 } 94 94 95 .widget button.customize-partial-edit-shortcut-absolute,96 .customize-partial-edit-shortcut-absolute {97 position: static;98 }99 100 95 .customize-partial-edit-shortcut-left-margin:before { 101 96 left: 0; -
trunk/src/wp-includes/js/customize-selective-refresh.js
r38967 r38972 142 142 $placementContainer = $( placement.container ); 143 143 $placementContainer.prepend( $editShortcut ); 144 if ( 'absolute' === $placementContainer.css( 'position' ) ) {145 $editShortcut.addClass( 'customize-partial-edit-shortcut-absolute' );146 $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) );147 partial.whenPageChanges( function() {148 $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) );149 } );150 }151 144 if ( ! $placementContainer.is( ':visible' ) || 'none' === $placementContainer.css( 'display' ) ) { 152 145 $editShortcut.addClass( 'customize-partial-edit-shortcut-hidden' ); 153 146 } 154 147 $editShortcut.toggleClass( 'customize-partial-edit-shortcut-left-margin', $editShortcut.offset().left < 1 ); 155 },156 157 /**158 * Call a callback function when the page changes.159 *160 * This calls a callback for any change that might require refreshing the edit shortcuts.161 *162 * @since 4.7163 *164 * @param {Function} callback The function to call when the page changes.165 * @returns {void}166 */167 whenPageChanges: function( callback ) {168 var debouncedCallback, $document;169 debouncedCallback = _.debounce( function() {170 // Timeout allows any page animations to finish171 setTimeout( callback, 100 );172 }, 350 );173 // When window is resized.174 $( window ).resize( debouncedCallback );175 // When any customizer setting changes.176 api.bind( 'change', debouncedCallback );177 $document = $( window.document );178 // After scroll in case there are fixed position elements179 $document.on( 'scroll', debouncedCallback );180 // After page click (eg: hamburger menus)181 $document.on( 'click', debouncedCallback );182 },183 184 /**185 * Return the CSS positioning for the edit shortcut for a given partial placement.186 *187 * @since 4.7188 *189 * @param {jQuery} $placementContainer The placement container element as a jQuery object.190 * @return {Object} Object containing CSS positions.191 */192 getEditShortcutPositionStyles: function( $placementContainer ) {193 return {194 top: $placementContainer.css( 'top' ),195 left: $placementContainer.css( 'left' ),196 right: 'auto'197 };198 148 }, 199 149
Note: See TracChangeset
for help on using the changeset viewer.