Saving scroll position

This commit is contained in:
Edin Dazdarevic
2017-04-06 03:20:13 +02:00
parent 21ec7c560d
commit a8698f8ad7
2 changed files with 16 additions and 1 deletions

View File

@@ -45,6 +45,9 @@ const setMaxSize = ({ type, action }, component) => {
};
const viewListingDetails = ({ type, action }, component) => {
const scrollElem = document.querySelector('.right-content');
component.savedScrollTop = scrollElem.scrollTop;
component.setState({
listingDetails: true,
listingId: action.id,
@@ -56,6 +59,8 @@ const viewListingDetails = ({ type, action }, component) => {
if (m) {
m.marker.setIcon(component.selectedMarkerIcon());
}
scrollElem.scrollTop = 0
});
};
@@ -195,6 +200,9 @@ const backToResults = ({type, action}, component) => {
if (prevSelected) {
prevSelected.marker.setIcon(component.visitedMarkerIcon());
}
const scrollElem = document.querySelector('.right-content');
scrollElem.scrollTop = component.savedScrollTop;
});
}