From c033a3a3e08c83127d13f75afa8b3539d5e06115 Mon Sep 17 00:00:00 2001 From: Joan Gimenez Donat Date: Tue, 29 Nov 2016 14:43:08 +0100 Subject: [PATCH] feature-expand-a-branch-element Added the feature to expand only the element you select. Example of use: $('#myList').data('sapling').expandElement('#element12'); --- jquery.sapling.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jquery.sapling.js b/jquery.sapling.js index 505f76f..7a0bdae 100644 --- a/jquery.sapling.js +++ b/jquery.sapling.js @@ -77,6 +77,11 @@ expand($element.find('.sapling-item')); }; + plugin.expandElement = function(element) { + expand($element.find(element)); + expand($(element).parents()); + }; + plugin.collapse = function() { collapse($element.find('.sapling-expanded')); }; @@ -112,4 +117,4 @@ }); }; -})(jQuery, window, document); \ No newline at end of file +})(jQuery, window, document);