aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-09-06 13:20:26 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-09-09 08:06:52 +0100
commitb2d6e1367210de416da25ac44ee370d03ab8962f (patch)
tree03fc94dbcc12d67e1c038345bedbb48013a86558
parentee026b1e36f57d67044d00d822502c576d4c150c (diff)
Fix scrolling error into view.
Firefox still only scrolls precisely to the focus.
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 208ac77ac..5c5e5cf9b 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -239,7 +239,9 @@ $.extend(fixmystreet.set_up, {
// make sure we can see the error message when we focus on invalid elements
showErrors: function( errorMap, errorList ) {
if ( submitted && errorList.length ) {
- $(window).scrollTop( $(errorList[0].element).offset().top - 120 );
+ var currScroll = $('#map_sidebar').scrollTop(),
+ pos = $(errorList[0].element).position().top;
+ $('#map_sidebar').scrollTop( currScroll + pos - 120 );
}
this.defaultShowErrors();
submitted = false;