]> git.openstreetmap.org Git - rails.git/commitdiff
Fix search result link behavior (systemed/iD#1329)
authorJohn Firebaugh <john.firebaugh@gmail.com>
Mon, 22 Apr 2013 23:23:29 +0000 (16:23 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 3 May 2013 17:52:44 +0000 (10:52 -0700)
app/views/site/id_iframe.html.erb

index 515c0e8072ab423e31506294e9d29cd8dce93b48..b4cfaf46109479c124046f3ad67272101be56c99 100644 (file)
     parent.$("body").on("click", "a.set_position", function (e) {
       e.preventDefault();
       var data = parent.$(this).data();
     parent.$("body").on("click", "a.set_position", function (e) {
       e.preventDefault();
       var data = parent.$(this).data();
-      id.map().centerZoom(
-        [data.lon, data.lat],
-        Math.max(data.zoom || 15, 13));
+
+      // 0ms timeout to avoid iframe JS context weirdness.
+      // http://bl.ocks.org/jfirebaugh/5439412
+      setTimeout(function() {
+        id.map().centerZoom(
+          [data.lon, data.lat],
+          Math.max(data.zoom || 15, 13));
+      }, 0);
     });
 
     var maximized = false;
     });
 
     var maximized = false;