How to maintain page scroll position after a jquery event is carried out?

前端 未结 7 1990
无人共我
无人共我 2020-12-04 23:47

I have searched high and low for an answer and have found similar examples of the problem but the answers do not apply to my scenario. The reality is I am new to this and th

7条回答
  •  借酒劲吻你
    2020-12-05 00:41

    You can save the current scroll amount and then set it later:

    var tempScrollTop = $(window).scrollTop();
    
    ..//Your code
    
    $(window).scrollTop(tempScrollTop);
    

提交回复
热议问题