On the page there is a button for loading goods. The specificity is that the whole set of goods comes, and not just new ones. Therefore, the insert is used to insert

$(".goods-content").html(data); 

In opera, the screen stays in place while adding, but in chrome it scrolls (rises) upwards. How to fix (stay in the same place)?

  • Remember the position of the scroll and when adding change using $(window).scrollTop(); . In general, you're lying. I checking in chrome does not scroll - Yuri
  • 2
    with this wording of the title can be redirected to the forum of philosophers) - lexxl
  • one
    Everything is ephemeral, do not enter into the same water twice .. - vp_arth
  • I suspect that before updating the data, you clear them. Do not do it this way. - vp_arth
  • No, cleaning does not happen - IK

2 answers 2

In my case, the problem was that Google uses pagespeed optimization on the server. After it was turned off, the problem disappeared.

    Try to remember the height of the block, then return the original value:

     $(".goods-content").css({height:$(".goods-content").height()}); $(".goods-content").html(data); setTimeout(function(){ $(".goods-content").css({height:'auto'}; },1000) 
    • Thanks, but did not help. Data is not updated - IK