I'm trying to create an off canvas navigation. This article provides some good techniques: http://tympanus.net/codrops/2013/08/28/transitions-for-off-canvas-navigations/comment-page-6/#comment-460738
I'm trying to understand the recursion techniques in the sidebarEffects.js file in above article: https://github.com/codrops/SidebarTransitions/blob/master/js/sidebarEffects.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!
This topic is now closed. New replies are no longer allowed.