From 66ce4c3b93655abbaef463d9f310c44fa6aed6f1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 18 Apr 2013 15:59:25 -0700 Subject: [PATCH] Fix P2 interaction with search links Need to prevent the default action so that the page isn't reloaded. Also, since the click event binding uses delegation, it isn't necessary to wrap it in $(document).ready(). --- app/views/site/_potlatch2.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/site/_potlatch2.html.erb b/app/views/site/_potlatch2.html.erb index 535992f2f..65ca9210e 100644 --- a/app/views/site/_potlatch2.html.erb +++ b/app/views/site/_potlatch2.html.erb @@ -71,13 +71,13 @@ doSWF(params.lat, params.lon, params.zoom || 17); <% end -%> - $(document).ready(function () { - $("body").on("click", "a.set_position", function () { - var data = $(this).data(); + $("body").on("click", "a.set_position", function (e) { + e.preventDefault(); - $("#potlatch").each(function () { - this.setPosition(data.lat, data.lon, Math.max(data.zoom || 15, 13)); - }); + var data = $(this).data(); + + $("#potlatch").each(function () { + this.setPosition(data.lat, data.lon, Math.max(data.zoom || 15, 13)); }); }); -- 2.43.2