When clicking a region, scroll only the list and not the whole page
Bug: 59175 Change-Id: I7b6b53ac01b99c6172830513f25ab51c6a83d919
This commit is contained in:
@@ -144,16 +144,20 @@
|
||||
},
|
||||
|
||||
click: function () {
|
||||
var $list, $firstTargetRegion;
|
||||
|
||||
// Don't do anything if a region is selected already
|
||||
if ( this.$element.hasClass( 'active' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$list = this.options.$target.$element;
|
||||
$firstTargetRegion = $list.find( '#' + this.regions[0] );
|
||||
|
||||
// Scroll to appropriate area
|
||||
this.options.$target.$element
|
||||
.find( '#' + this.regions[0] )
|
||||
.get( 0 )
|
||||
.scrollIntoView( true, { behavior: 'smooth' } );
|
||||
$list.scrollTop(
|
||||
$firstTargetRegion.offset().top - $list.offset().top + $list.scrollTop()
|
||||
);
|
||||
|
||||
// Make the selected region (and it only) active
|
||||
$( '.regionselector' ).removeClass( 'active' );
|
||||
|
||||
Reference in New Issue
Block a user