mirror of
git://develop.git.wordpress.org/
synced 2025-02-26 17:42:26 +01:00
Only show the media library loading spinner if we're scrolled toward the bottom. Prevents the spinner from flashing a second time when first loading the library due to a second query firing after initial load.
props kovshenin. fixes #24859. git-svn-id: https://develop.svn.wordpress.org/trunk@28019 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8b9371e915
commit
784d1dc9bf
@ -4888,17 +4888,19 @@
|
||||
|
||||
scroll: function() {
|
||||
var view = this,
|
||||
toolbar;
|
||||
toolbar = this.views.parent.toolbar;
|
||||
|
||||
// @todo: is this still necessary?
|
||||
if ( ! this.$el.is(':visible') ) {
|
||||
// @todo: is :visible still necessary?
|
||||
if ( ! this.$el.is(':visible') || ! this.collection.hasMore() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.collection.hasMore() && this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
|
||||
toolbar = this.views.parent.toolbar;
|
||||
// Show the spinner only if we are close to the bottom.
|
||||
if ( this.el.scrollHeight - ( this.el.scrollTop + this.el.clientHeight ) < this.el.clientHeight / 3 ) {
|
||||
toolbar.get('spinner').show();
|
||||
}
|
||||
|
||||
if ( this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {
|
||||
this.collection.more().done(function() {
|
||||
view.scroll();
|
||||
toolbar.get('spinner').hide();
|
||||
|
Loading…
x
Reference in New Issue
Block a user