-1
I am having difficulties in performing an activity that is to keep the scroll in the LAST position before the AJAX request.
//antes da requisição
var scrollPosition = $('.cart').scrollTop();
==> REQUISIÇÃO
$.ajax({...})
.done(function () {
//depois da requisição
$('.cart').scrollTop(scrollPosition)
})
When I perform this way the scroll keeps going up little by little with each request.
If I use Animate:
('.cart').animate({scrollTop: scrollPosition})
The code works however I need to make the scroll FIXED, because when using Animate, the scroll goes down from the top to the position.
If you also have a way that by refreshing AJAX do not change the scroll would be a good way.
I’ve tried by localStorage/sessionStorage and it doesn’t work.
What is leaving me with enough doubts is why the Scroll rises little by little with each refresh.
I can only use JQUERY