From d180953fab70128ce1e8215d98177456482d6051 Mon Sep 17 00:00:00 2001 From: Josh Angell Date: Thu, 1 Mar 2012 16:35:07 +0000 Subject: Add scroll to top js when map is completed on mobile Signed-off-by: Josh Angell --- web/js/map-OpenLayers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index 3a6cec3e5..414bb1fc5 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -469,8 +469,12 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { //scroll the height of the map box instead of the offset //of the #side-form or whatever as we will probably want //to do this on other pages where #side-form might not be - var height = $('#map_box').height(); - $('html, body').animate({scrollTop:height-60}, 1000); + if($(this).parent().hasClass('map_complete')){ + $('html, body').animate({scrollTop:0}, 1000); + }else{ + var height = $('#map_box').height(); + $('html, body').animate({scrollTop:height-60}, 1000); + } //add this class so we can modify the look of the links inside $('#mob_sub_map_links').addClass('map_complete'); -- cgit v1.2.3