How can I retain the scroll position of a scrollable area when pressing back button?

后端 未结 5 1757
故里飘歌
故里飘歌 2020-12-01 03:15

I have a long list of links inside a big scrollable div. Each time when a user click on a link then click the back button, it starts at the very top of the div. It is not us

5条回答
  •  半阙折子戏
    2020-12-01 03:38

    When using window.history.back(), this is actually default browser functionality as user SD. has pointed out.

    On a site I am currently building, I wanted the logo of the company to backlink to the index page. Since jQuery 3, $(window).unload(function() should be rewritten to $(window).on('unload', function(). My code looks like this (using Kirby CMS' php syntax):

    template() == 'home'): ?>
    
    
    

提交回复
热议问题