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

9
web/dist/main.css vendored
View File

@@ -571,6 +571,13 @@ html {
.ld-header { .ld-header {
display: flex; display: flex;
background: hsla(0,0%,100%,.9);
padding-top: 10px;
padding-bottom: 10px;
position: fixed;
top: 60px;
z-index: 100;
width: 100%;
} }
.ld-header .back-to-results { .ld-header .back-to-results {
@@ -605,7 +612,7 @@ html {
.ld-details { .ld-details {
border: 1px solid #e6e6e6; border: 1px solid #e6e6e6;
padding: 0 10px; padding: 0 10px;
margin-top: 15px; margin-top: 45px;
} }
.image-dots { .image-dots {

View File

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