Changeset 26703
- Timestamp:
- 12/05/2013 11:13:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/widgets.js
r26696 r26703 404 404 405 405 addWidget: function( chooser ) { 406 var widget, widgetId, add, n, 406 var widget, widgetId, add, n, viewportTop, viewportBottom, sidebarBounds, 407 407 sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'), 408 408 sidebar = $( '#' + sidebarId ); … … 448 448 * the bounds of the viewport. 449 449 */ 450 v ar viewport_top = $(window).scrollTop(),451 viewport_bottom = viewport_top + $(window).height(),452 sidebar_bounds = sidebar.offset();450 viewportTop = $(window).scrollTop(); 451 viewportBottom = viewportTop + $(window).height(); 452 sidebarBounds = sidebar.offset(); 453 453 454 sidebar _bounds.bottom = sidebar_bounds.top + sidebar.outerHeight();455 456 if ( viewport _top > sidebar_bounds.bottom || viewport_bottom < sidebar_bounds.top ) {454 sidebarBounds.bottom = sidebarBounds.top + sidebar.outerHeight(); 455 456 if ( viewportTop > sidebarBounds.bottom || viewportBottom < sidebarBounds.top ) { 457 457 $( 'html, body' ).animate({ 458 scrollTop: sidebar .offset().top - 130458 scrollTop: sidebarBounds.top - 130 459 459 }, 200 ); 460 460 }
Note: See TracChangeset
for help on using the changeset viewer.