RegionSelector: Scroll to appropriate area instead of rebuilding the list
This has been suggested on bug 39925.
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
this.options = $.extend( {}, $.fn.regionselector.defaults, options );
|
this.options = $.extend( {}, $.fn.regionselector.defaults, options );
|
||||||
this.$element.addClass( 'regionselector' );
|
this.$element.addClass( 'regionselector' );
|
||||||
this.regions = [];
|
this.regions = [];
|
||||||
this.cache= null;
|
this.cache = null;
|
||||||
this.regionGroup = this.$element.data( 'regiongroup' );
|
this.regionGroup = this.$element.data( 'regiongroup' );
|
||||||
this.init();
|
this.init();
|
||||||
this.listen();
|
this.listen();
|
||||||
@@ -149,9 +149,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-populate the list of languages
|
// Scroll to appropriate area
|
||||||
this.options.$target.empty();
|
this.options.$target.$element
|
||||||
this.show();
|
.find( '#' + this.regions[0] )
|
||||||
|
.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