From 1fddc8bbb97ed3d998d46de1b23a3c3aded9accf Mon Sep 17 00:00:00 2001 From: patricksimpson Date: Tue, 6 Aug 2013 13:55:00 -0400 Subject: [PATCH 1/3] update jquery and replaced live with on --- index.html | 4 ++-- js/jquery.sparkbox-select.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 13f5272..a9aa500 100644 --- a/index.html +++ b/index.html @@ -21,8 +21,8 @@ - + - \ No newline at end of file + diff --git a/js/jquery.sparkbox-select.js b/js/jquery.sparkbox-select.js index abc6d15..095feef 100644 --- a/js/jquery.sparkbox-select.js +++ b/js/jquery.sparkbox-select.js @@ -186,10 +186,10 @@ // Hide dropdown when click is outside of the input or dropdown $(document).bind('click', hideDropdown); - $('.sb-custom').find('.sb-select').live('keydown', selectKeypress); + $('.sb-custom').find('.sb-select').on('keydown', selectKeypress); $('.sb-custom').bind('blur', clearKeyStrokes); $(document).delegate('.sb-dropdown', 'focus', viewList); return this; }; -})(jQuery); \ No newline at end of file +})(jQuery); From ca9673f86b628045dedcc1fa830cac0648091658 Mon Sep 17 00:00:00 2001 From: patricksimpson Date: Tue, 6 Aug 2013 13:56:29 -0400 Subject: [PATCH 2/3] Adding functionality to hide when dropdown is clicked again. --- js/jquery.sparkbox-select.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/jquery.sparkbox-select.js b/js/jquery.sparkbox-select.js index 095feef..b9ed11b 100644 --- a/js/jquery.sparkbox-select.js +++ b/js/jquery.sparkbox-select.js @@ -54,8 +54,14 @@ // Clear keystroke matching string and show dropdown var viewList = function(e) { var $this = $(this), - id = $this.data('id'); - + id = $this.data('id'), + $current = $('.sb-dropdown[data-id=' + $this.data('id') + ']').find('.selected'); + if ($current.is(':visible')){ + console.log("visible"); + hideDropdown($current[0]); + return; + } + clearKeyStrokes(); $('.sb-dropdown').filter('[data-id!=' + id + ']').fadeOut('fast'); From 6212ed70984294537e390aea27d0992e89de9a78 Mon Sep 17 00:00:00 2001 From: patricksimpson Date: Tue, 6 Aug 2013 13:57:43 -0400 Subject: [PATCH 3/3] removed console.log --- js/jquery.sparkbox-select.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/jquery.sparkbox-select.js b/js/jquery.sparkbox-select.js index b9ed11b..8fd7e6c 100644 --- a/js/jquery.sparkbox-select.js +++ b/js/jquery.sparkbox-select.js @@ -57,7 +57,6 @@ id = $this.data('id'), $current = $('.sb-dropdown[data-id=' + $this.data('id') + ']').find('.selected'); if ($current.is(':visible')){ - console.log("visible"); hideDropdown($current[0]); return; }