Results 1 to 1 of 1
Jun 19, 2014, 08:50 #1
- Join Date
- Jun 2014
- 0 Post(s)
- 0 Thread(s)
How to use recursion techniques in off canvas navigations
I'm trying to create an off canvas navigation. This article provides some good techniques: http://tympanus.net/codrops/2013/08/...comment-460738
I'm trying to understand the recursion techniques in the sidebarEffects.js file in above article: https://github.com/codrops/SidebarTr...ebarEffects.js
The function hasParentClass (line 13) and bodyClickFn (line 38) all use recursion techniques.
I understand hasParentClass (line 13) uses recursion to repeatedly look for any element has parent "st-menu" (line 38) - please correct me if I'm wrong.
But for bodyClickFn (line 38), this function already has "resetMenu();" to hide the menu. I'm not quite sure why do we need this line "document.removeEventListener( eventtype, bodyClickFn );".
Any explanation is helpful. Many thanks!