1. What we are currently doing is to locate the original position when returning from the details page to the list page in the angular mobile terminal.
2. My code is to record the current position on the list page
document.addEventListener('touchstart', function (e) {
console.log(angular.element(e.target)[0].offsetTop);
var eleTop = angular.element(e.target)[0].offsetTop;
localStorage.setItem("top", eleTop);
}, false);
Return function: But the value printed here is no longer the value originally stored, but the position when clicking return.
function goBack() {
console.log(localStorage.getItem("top"));
history.back();
}
Please tell me how to locate the value recorded in the list page, or is there any better way?
Thanks!
Change entering the details page to js trigger, record the current position before jumping, enter the page to verify whether there is this value, if so, let the page stay at this position, and clear this value, if not, skip. The idea is probably this, the code is completed by itself. If you don’t understand that part, you can ask me. If you want the complete code, don’t ask me