From 01b4f7d29aa12978b25d93f52330879d76a69f94 Mon Sep 17 00:00:00 2001 From: Beanow Date: Tue, 16 Sep 2014 01:21:27 +0200 Subject: [PATCH 1/2] Menu links now collapse if clicked again. --- js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 1686fc9b78..87b95d62ff 100644 --- a/js/main.js +++ b/js/main.js @@ -80,19 +80,23 @@ } } $('a[rel^=#]').click(function(e){ + e.preventDefault(); + var $parent = $(this).parent(); + var isSelected = (last_popup_button && $parent.attr('id') == last_popup_button.attr('id')); close_last_popup_menu(); + if(isSelected) return false; menu = $( $(this).attr('rel') ); e.preventDefault(); e.stopPropagation(); if (menu.attr('popup')=="false") return false; - $(this).parent().toggleClass("selected"); + $parent.toggleClass("selected"); menu.toggle(); if (menu.css("display") == "none") { last_popup_menu = null; last_popup_button = null; } else { last_popup_menu = menu; - last_popup_button = $(this).parent(); + last_popup_button = $parent; } return false; }); From 5bc69ccc70394fae541e44ed59ff6d989d0de77e Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Wed, 17 Sep 2014 08:57:53 +0200 Subject: [PATCH 2/2] remove dollar sign --- js/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/main.js b/js/main.js index 87b95d62ff..43d37a99bf 100644 --- a/js/main.js +++ b/js/main.js @@ -81,22 +81,22 @@ } $('a[rel^=#]').click(function(e){ e.preventDefault(); - var $parent = $(this).parent(); - var isSelected = (last_popup_button && $parent.attr('id') == last_popup_button.attr('id')); + var parent = $(this).parent(); + var isSelected = (last_popup_button && parent.attr('id') == last_popup_button.attr('id')); close_last_popup_menu(); if(isSelected) return false; menu = $( $(this).attr('rel') ); e.preventDefault(); e.stopPropagation(); if (menu.attr('popup')=="false") return false; - $parent.toggleClass("selected"); + parent.toggleClass("selected"); menu.toggle(); if (menu.css("display") == "none") { last_popup_menu = null; last_popup_button = null; } else { last_popup_menu = menu; - last_popup_button = $parent; + last_popup_button = parent; } return false; });