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

前端 未结 7 1984
无人共我
无人共我 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:38

    $('html,body').animate({
      scrollTop: $('#answer-<%= @answer.id %>').offset().top - 50
    }, 700);
    

提交回复
热议问题