Saving scroll position
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user