]> git.openstreetmap.org Git - rails.git/commitdiff
Stop the menu appearing when the anchor is disabled
authorTom Hughes <tom@compton.nu>
Thu, 12 Apr 2012 14:41:11 +0000 (15:41 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 23 Apr 2012 19:59:28 +0000 (20:59 +0100)
app/assets/javascripts/menu.js

index 595b153986f3e102424bccec97db812eb7bde3a3..a01fc39cc68bbfe86f85f79a0e786a4c8f77481c 100644 (file)
@@ -34,14 +34,16 @@ function createMenu(anchorid, menuid, align) {
   }
 
   $arrow.click(function(e) {
-    e.stopPropagation();
-    e.preventDefault();
-    if ($menu.is(":visible")) {
-      $menu.hide();
-      $page.off("click", hide);
-    } else {
-      openMenu($anchor, $menu.show(), align);
-      $page.on("click", hide);
+    if ($anchor.is(":not(.disabled)")) {
+      e.stopPropagation();
+      e.preventDefault();
+      if ($menu.is(":visible")) {
+        $menu.hide();
+        $page.off("click", hide);
+      } else {
+        openMenu($anchor, $menu.show(), align);
+        $page.on("click", hide);
+      }
     }
   });
 }