I am currently working on a messaging system using Backbone. I want to scroll to the last item in a CollectionView on a render.
I can make this work after clicking the link on the page, but I want this to happen on the rendering of the view.
Here is what I use in a link that works:
document.getElementById('message-new-conversation-dialog').scrollIntoView();
Here's a definition of the form:
var ConversationView = LSmixBB.CollectionView.extend({
itemView: MessageView,
template: "#message-conversation-template",
onRender: function(){
document.getElementById('message-new-conversation-dialog').scrollIntoView();
document.getElementById('global-column-middle-footer1').scrollIntoView();
}
});
I assume it doesn't work because there is nothing on the page inside onRender?
I am very new to web development, so be gentle!
In any case, I would really appreciate any help!
source
share