I have a division containing text, and when I submit that text, new data is obtained from the server. If I happen to be at the bottom of the original text, the newly received text also appears at the bottom. Ideally, I would like the page to scroll up to the top of the text each time new data is retrieved.
<b-row class="question-top mb-3" >
<b-col xl="12" md="12" sm="12" xs="12">
<div class="question-editor">
<ckeditor :editor="editor" v-model="free_text" :disabled="editorDisabled"></ckeditor>
</div>
</b-col>
</b-row>
//style
.question-editor{
overflow-y: auto; //this enables scrolling within the div
}
methods(){
getData() {
axios...CODE..
//scrolling to the top of the div after receiving new data
var topElement = document.querySelector('.question-editor');
scrollTo(topElement, 0, 100);
}
}