Here is the one line of code I use to push a new row to my container:
this.$el.append(new ItemView(item).render().el);
Where item
is a Backbone.js model, render()
creates and/or modifies the object and el
is the html element. (The object is never displayed until rendering is complete)
How can I keep** new ItemView(item).render()
**and store it in a variable, then fade and slide it into (the bottom) of my container?
Edit
Please keep in mind that this.$el
is the container element.
var rendered = new ItemView(item).render();
$(rendered.el).appendTo(this.$el).hide().fadeIn().slideDown();
Set attribute to your element style="display: none;" so when you append it it wont be visible. Then after add exec fadein function and your element will be visible.
I hopt this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With