Widgets: jshint cleanup of widgets.js, see #25821.
Built from https://develop.svn.wordpress.org/trunk@26703 git-svn-id: http://core.svn.wordpress.org/trunk@26593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e7f80a8fad
commit
765b617a8c
|
@ -403,7 +403,7 @@ wpWidgets = {
|
||||||
},
|
},
|
||||||
|
|
||||||
addWidget: function( chooser ) {
|
addWidget: function( chooser ) {
|
||||||
var widget, widgetId, add, n,
|
var widget, widgetId, add, n, viewportTop, viewportBottom, sidebarBounds,
|
||||||
sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'),
|
sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'),
|
||||||
sidebar = $( '#' + sidebarId );
|
sidebar = $( '#' + sidebarId );
|
||||||
|
|
||||||
|
@ -447,15 +447,15 @@ wpWidgets = {
|
||||||
* We do this by comparing the top and bottom, of the sidebar so see if they are within
|
* We do this by comparing the top and bottom, of the sidebar so see if they are within
|
||||||
* the bounds of the viewport.
|
* the bounds of the viewport.
|
||||||
*/
|
*/
|
||||||
var viewport_top = $(window).scrollTop(),
|
viewportTop = $(window).scrollTop();
|
||||||
viewport_bottom = viewport_top + $(window).height(),
|
viewportBottom = viewportTop + $(window).height();
|
||||||
sidebar_bounds = sidebar.offset();
|
sidebarBounds = sidebar.offset();
|
||||||
|
|
||||||
sidebar_bounds.bottom = sidebar_bounds.top + sidebar.outerHeight();
|
sidebarBounds.bottom = sidebarBounds.top + sidebar.outerHeight();
|
||||||
|
|
||||||
if ( viewport_top > sidebar_bounds.bottom || viewport_bottom < sidebar_bounds.top ) {
|
if ( viewportTop > sidebarBounds.bottom || viewportBottom < sidebarBounds.top ) {
|
||||||
$( 'html, body' ).animate({
|
$( 'html, body' ).animate({
|
||||||
scrollTop: sidebar.offset().top - 130
|
scrollTop: sidebarBounds.top - 130
|
||||||
}, 200 );
|
}, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue