I want to show a loading message/icon until all the items in the list have been rendered.
Here is the jsfiddle with my example: http://jsfiddle.net/9R9zU/58/
I've tried to add a div with a loading bar in the Feed section, but it doesn't work.
How can I show a loading message before all the book views are rendered in the book list view:
app.BookListView = Backbone.View.extend({
el: '.feed',
initialize: function() {
this.render();
this.listenTo( this.collection, 'add', this.renderBook );
Here's a working example: http://jsfiddle.net/aJfUx/1/
And here's an example that uses
setTimeout
to artificially add some loading time so you can see that spinner spin!http://jsfiddle.net/7ddXM/
In theory you need to
fetch
some content asynchronously from somewhere to display the loader. A loading is needed to show the user that you are actually fetching the content and that the UI is not dead. In that fiddle even if you got it working you won't be able to see it because the collection is bootstrapped and you are not fetching anything.This simulates that (updated your fiddle):