From c883c3a7741b6065d39c4efe0d9098c02a47efe8 Mon Sep 17 00:00:00 2001 From: Santhosh Thottingal Date: Wed, 24 Oct 2012 18:18:18 +0530 Subject: [PATCH] Avoid jumping to WW while scrolling up. Correct the precision of scroll top by taking padding into account. Fixes https://bugzilla.wikimedia.org/show_bug.cgi?id=39224 Change-Id: I988e9a09018bf2d5c27f11d21947e036c79f56b9 --- src/jquery.uls.lcd.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 7aef642..afc7e0a 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -272,9 +272,10 @@ lcd.$element.find( 'div.uls-lcd-region-section' ).each( function () { var $lcdRegionSection = $( this ), top = $lcdRegionSection.position().top, - height = $lcdRegionSection.height(); + height = $lcdRegionSection.height(), + padding = 10; - if ( top < scrollTop && height > scrollBottom ) { + if ( top - padding <= scrollTop && height > scrollBottom ) { inviewRegion = $lcdRegionSection.attr( 'id' ); return true; }