Fix scroll position on map viewport change
Scroll to bottom of .property-filters minus masthead height when map viewport changes and results refresh. Only scrolls upward, never down. Uses instant scroll behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -1773,9 +1773,17 @@
|
||||
InfiniteScrollState.pages = {};
|
||||
InfiniteScrollState.pendingPage = null;
|
||||
|
||||
// Scroll to bottom edge of .property-filters - bottom margin + masthead height
|
||||
var $filters = $('.property-filters').first();
|
||||
var $masthead = $('#masthead');
|
||||
if ($filters.length) {
|
||||
var mastheadHeight = $masthead.length ? $masthead.outerHeight() : 0;
|
||||
var targetScroll = $filters.offset().top + $filters.outerHeight() - mastheadHeight;
|
||||
var currentScroll = window.scrollY || window.pageYOffset;
|
||||
if (currentScroll > 0) {
|
||||
window.scrollTo(0, 0);
|
||||
// Only scroll up, never down
|
||||
if (currentScroll > targetScroll) {
|
||||
window.scrollTo({ top: targetScroll, behavior: 'instant' });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user