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 () {
|
click: function () {
|
||||||
|
var $list, $firstTargetRegion;
|
||||||
|
|
||||||
// Don't do anything if a region is selected already
|
// Don't do anything if a region is selected already
|
||||||
if ( this.$element.hasClass( 'active' ) ) {
|
if ( this.$element.hasClass( 'active' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$list = this.options.$target.$element;
|
||||||
|
$firstTargetRegion = $list.find( '#' + this.regions[0] );
|
||||||
|
|
||||||
// Scroll to appropriate area
|
// Scroll to appropriate area
|
||||||
this.options.$target.$element
|
$list.scrollTop(
|
||||||
.find( '#' + this.regions[0] )
|
$firstTargetRegion.offset().top - $list.offset().top + $list.scrollTop()
|
||||||
.get( 0 )
|
);
|
||||||
.scrollIntoView( true, { behavior: 'smooth' } );
|
|
||||||
|
|
||||||
// Make the selected region (and it only) active
|
// Make the selected region (and it only) active
|
||||||
$( '.regionselector' ).removeClass( 'active' );
|
$( '.regionselector' ).removeClass( 'active' );
|
||||||
|
|||||||
Reference in New Issue
Block a user