mirror of
git://develop.git.wordpress.org/
synced 2025-01-19 05:38:07 +01:00
Themes: Use _.throttle() instead of a custom one. Props matveb. Fixes #25981
git-svn-id: https://develop.svn.wordpress.org/trunk@26467 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
766427b133
commit
cfdfd0908b
@ -29,21 +29,12 @@ themes.view.Appearance = wp.Backbone.View.extend({
|
|||||||
|
|
||||||
// Sets up a throttler for binding to 'scroll'
|
// Sets up a throttler for binding to 'scroll'
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var self = this;
|
// Scroller checks how far the scroll position is
|
||||||
|
_.bindAll( this, 'scroller' );
|
||||||
|
|
||||||
// Keep a boolean check so that we don't run
|
// Bind to the scroll event and throttle
|
||||||
// too much code on every event trigger
|
// the results from this.scroller
|
||||||
this.window.bind( 'scroll.themes', function() {
|
this.window.bind( 'scroll', _.throttle( this.scroller, 300 ) );
|
||||||
this.throttle = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
setInterval( function() {
|
|
||||||
if ( this.throttle ) {
|
|
||||||
// Once the case is the case, the action occurs and the fact is no more
|
|
||||||
this.throttle = false;
|
|
||||||
self.scroller();
|
|
||||||
}
|
|
||||||
}, 300 );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Main render control
|
// Main render control
|
||||||
|
Loading…
x
Reference in New Issue
Block a user