//onchange #/home 切换主页 $("body").html(home) #/artcle 切换文章页 $("body").html(artcle)
但是页面切换html代码给替换了,如何保存之前的数据和状态还有滚动的位置呢?
业精于勤,荒于嬉;行成于思,毁于随。
Use localStorage to save scrollTop and data, then fill in the data if localStorage has data Clear localStorage when leaving the page
Use localStorage to save scrollTop and data,
then fill in the data if localStorage has data
Clear localStorage when leaving the page