From 9c7e96e2d3a3c55552e5a5db3ee152e0db81d2b9 Mon Sep 17 00:00:00 2001 From: lukemelia Date: Fri, 30 Jun 2006 03:27:48 +0000 Subject: [PATCH] Collapsing contexts was allowing the link clicked to be processed, and since the href just consists of "#", the page would scroll to the top. This commit fixes that problem. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@273 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/public/javascripts/todo-items.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tracks/public/javascripts/todo-items.js b/tracks/public/javascripts/todo-items.js index f67dd808..006ec574 100644 --- a/tracks/public/javascripts/todo-items.js +++ b/tracks/public/javascripts/todo-items.js @@ -15,6 +15,7 @@ var todoItems = { var toggleElems = document.getElementsByClassName('container_toggle'); toggleElems.each(function(toggleElem){ Event.observe(toggleElem, 'click', todoItems.toggleNextActionListing); + toggleElem.onclick = function() {return false;}; //workaround for Event.stop problem with Safari 2.0.3. See http://particletree.com/notebook/eventstop/ containerElem = todoItems.findNearestParentByClassName(toggleElem, "container"); collapsedCookie = contextCollapseCookieManager.getCookie(todoItems.buildCookieName(containerElem)); if (collapsedCookie) @@ -41,8 +42,9 @@ var todoItems = { new Effect.Fade(fadingElemId,{afterFinish:function(effect) { Element.remove(fadingElemId); }, duration:0.4}); }, - toggleNextActionListing: function() + toggleNextActionListing: function(event) { + Event.stop(event); itemsElem = todoItems.findItemsElem(this); containerElem = todoItems.findNearestParentByClassName(this, "container"); if (Element.visible(itemsElem)) @@ -55,7 +57,6 @@ var todoItems = { todoItems.expandNextActionListing(this, itemsElem); contextCollapseCookieManager.clearCookie(todoItems.buildCookieName(containerElem)) } - return false; }, expandNextActionListing: function(toggleElem, itemsElem)