jenkins-bot has submitted this change and it was merged. Change subject: Update jquery.uls from upstream ......................................................................
Update jquery.uls from upstream Change-Id: Id91d0551ec329fb6645d3e6c3610ca5f3e8670b4 --- M lib/jquery.uls/src/jquery.uls.core.js 1 file changed, 30 insertions(+), 1 deletion(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/jquery.uls/src/jquery.uls.core.js b/lib/jquery.uls/src/jquery.uls.core.js index 4593f8d..7286a74 100644 --- a/lib/jquery.uls/src/jquery.uls.core.js +++ b/lib/jquery.uls/src/jquery.uls.core.js @@ -181,7 +181,7 @@ $( '.uls-menu' ).hide(); this.$menu.show(); - this.$menu[0].scrollIntoView(); + this.$menu.scrollIntoView(); this.shown = true; if ( !this.isMobile() ) { @@ -423,5 +423,34 @@ }; } + /* + * Simple scrollIntoView plugin. + * Scrolls the element to the viewport smoothly if it is not already. + */ + $.fn.scrollIntoView = function () { + return this.each( function () { + var scrollPosition, + $window = $( window ), + windowHeight = $window.height(), + windowScrollTop = $window.scrollTop(), + windowBottom = windowScrollTop + windowHeight, + $element = $( this ), + panelHeight = $element.height(), + panelTop = $element.offset().top, + panelBottom = panelTop + panelHeight; + + if ( ( panelTop < windowScrollTop ) || ( panelBottom > windowBottom ) ) { + if ( panelHeight > windowHeight ) { + scrollPosition = panelTop; + } else { + scrollPosition = panelBottom - windowHeight; + } + $( 'html, body' ).stop().animate( { + scrollTop: scrollPosition + }, 500 ); + } + } ); + } + $.fn.uls.Constructor = ULS; } ( jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/67057 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id91d0551ec329fb6645d3e6c3610ca5f3e8670b4 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits