Merge pull request #63 from amire80/bug_43568
Render every region only once
This commit is contained in:
@@ -272,7 +272,8 @@
|
|||||||
|
|
||||||
// The region section need to be in sync with the map filter.
|
// The region section need to be in sync with the map filter.
|
||||||
lcd.$element.scroll( function () {
|
lcd.$element.scroll( function () {
|
||||||
var $ulsLanguageList = $( this ),
|
var inview, inviewRegion,
|
||||||
|
$ulsLanguageList = $( this ),
|
||||||
scrollTop = $ulsLanguageList.position().top,
|
scrollTop = $ulsLanguageList.position().top,
|
||||||
scrollBottom = $ulsLanguageList.height();
|
scrollBottom = $ulsLanguageList.height();
|
||||||
|
|
||||||
@@ -282,7 +283,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The region section need to be in sync with the map filter.
|
// The region section need to be in sync with the map filter.
|
||||||
var inviewRegion = 'WW';
|
inviewRegion = 'WW';
|
||||||
lcd.$element.find( 'div.uls-lcd-region-section' ).each( function () {
|
lcd.$element.find( 'div.uls-lcd-region-section' ).each( function () {
|
||||||
var $lcdRegionSection = $( this ),
|
var $lcdRegionSection = $( this ),
|
||||||
top = $lcdRegionSection.position().top,
|
top = $lcdRegionSection.position().top,
|
||||||
@@ -296,7 +297,7 @@
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
var inview = $.uls.data.regiongroups[inviewRegion];
|
inview = $.uls.data.regiongroups[inviewRegion];
|
||||||
$( '.regionselector' ).removeClass( 'active' );
|
$( '.regionselector' ).removeClass( 'active' );
|
||||||
$( '#uls-region-' + inview ).addClass( 'active' );
|
$( '#uls-region-' + inview ).addClass( 'active' );
|
||||||
} );
|
} );
|
||||||
|
|||||||
@@ -110,21 +110,22 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
next: function () {
|
next: function () {
|
||||||
if ( !this.$element.hasClass( 'active') ) {
|
var regionSelector = this;
|
||||||
|
|
||||||
|
if ( !this.$element.hasClass( 'active' ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var regionSelector = this;
|
|
||||||
// Do not respond to all scroll end events, but only after a short interval
|
// Do not respond to all scroll end events, but only after a short interval
|
||||||
delay( function () {
|
delay( function () {
|
||||||
var regiongroup = regionSelector.$element.data( 'regiongroup' );
|
var nextRegionGroupNumber = regionSelector.$element.data( 'regiongroup' ) + 1,
|
||||||
var nextRegiongroup = regiongroup + 1;
|
$nextRegion = $( '#uls-region-' + nextRegionGroupNumber ),
|
||||||
|
nextRegionSelector = $nextRegion.length && $nextRegion.data( 'regionselector' );
|
||||||
|
|
||||||
var $nextRegion = $( '#uls-region-' + nextRegiongroup );
|
// If cache is defined, then it is already rendered and there's no need
|
||||||
var next = $nextRegion.length && $nextRegion.data( 'regionselector' );
|
// to re-render it.
|
||||||
|
if ( nextRegionSelector && nextRegionSelector.cache === null ) {
|
||||||
if ( next ) {
|
nextRegionSelector.show();
|
||||||
next.show();
|
|
||||||
}
|
}
|
||||||
}, 100 );
|
}, 100 );
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@
|
|||||||
|
|
||||||
listen: function () {
|
listen: function () {
|
||||||
this.$element.on( 'click', $.proxy( this.click, this ) );
|
this.$element.on( 'click', $.proxy( this.click, this ) );
|
||||||
this.options.$target.$element.bind( 'scrollend', $.proxy( this.next, this) );
|
this.options.$target.$element.bind( 'scrollend', $.proxy( this.next, this ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
click: function ( e ) {
|
click: function ( e ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user