Reputation: 295
My question is related the following fiddle. http://jsfiddle.net/PGuB5/84/
In this fiddle, Click the add row button, the row will be added. The scroll bar will be displayed automatically after some content added.
$('.scrollToBottom').on('click', function() {
$(".scrollbox").scrollTop($(".scrollbox")[0].scrollHeight);
});
Now I scroll the content at the bottom of the container and click the add row button. The scroll bar position is stay in the bottom.
I want, If I click the add row button, the scroll bar need to move to top.
Upvotes: 0
Views: 103
Reputation: 20636
For scrolling to top, use :
$('.scrollbox').scrollTop(0);
$('.addrow').on('click', function() {
$('.scrollbox').append(newline);
$('.scrollbox').scrollTop(0);
});
Upvotes: 1