Created
November 3, 2016 22:06
-
-
Save sampsonbryce/5ce5472efee813f71717a44e9ddd1905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attach quicktree to jquery | |
(function($) { | |
$.fn.quicktree = function() { | |
function click(e) { | |
var a = $(this); | |
a.next('ul').children("li").toggle(); | |
a.parent().parent().parent().find('.active').removeClass('active'); | |
a.addClass('active'); | |
e.preventDefault(); | |
} | |
// Grab the LI's and iterate over them | |
$(this).find("li").each(function(ind) { | |
var t = $(this); | |
t.children("a").off('click').click(click); | |
t.children('ul').quicktree(); | |
}); | |
return this; | |
}; | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment