Ticket #27406: 27406.scroll-position-fixes.diff
File 27406.scroll-position-fixes.diff, 1.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/accordion.js
69 69 } 70 70 71 71 function panelSwitch( panel ) { 72 var position, 72 var position, scroll, 73 73 section = panel.closest( '.accordion-section' ), 74 container = section.closest( '.wp-full-overlay' ), 74 overlay = section.closest( '.wp-full-overlay' ), 75 container = section.closest( '.accordion-container' ), 75 76 siblings = container.find( '.accordion-section.open' ), 76 77 content = section.find( '.control-panel-content' ); 77 78 78 79 if ( section.hasClass( 'current-panel' ) ) { 79 80 section.toggleClass( 'current-panel' ); 80 container.toggleClass( 'in-sub-panel' );81 overlay.toggleClass( 'in-sub-panel' ); 81 82 content.delay( 180 ).hide( 0, function() { 82 83 content.css( 'margin-top', 'inherit' ); // Reset 83 84 } ); 85 container.scrollTop( 0 ); 84 86 } else { 85 87 siblings.removeClass( 'open' ); 86 88 content.show( 0, function() { 87 89 position = content.offset().top; 88 content.css( 'margin-top', ( 45 - position ) ); 90 scroll = container.scrollTop(); 91 content.css( 'margin-top', ( 45 - position - scroll ) ); 89 92 section.toggleClass( 'current-panel' ); 90 container.toggleClass( 'in-sub-panel' ); 93 overlay.toggleClass( 'in-sub-panel' ); 94 container.scrollTop( 0 ); 91 95 } ); 92 96 } 93 97 }