javascript - How to return to the original position of the list page from the details page on the mobile terminal?
给我你的怀抱
给我你的怀抱 2017-07-05 10:37:41
0
1
976

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!

给我你的怀抱
给我你的怀抱

reply all(1)
某草草

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template