Created
September 18, 2014 17:27
-
-
Save ryanschuhler/d8df092472f9af5e9b33 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var toggleAction = function (event) { | |
| body.toggleClass('nav-show'); | |
| html.toggleClass('no-scroll'); | |
| navContent.all('ul ul .selected').each( | |
| function (e) { | |
| e.ancestor('ul').removeClass('aui-helper-hidden'); | |
| e.ancestor('.selected').one('.has-child-marker').addClass('child-show'); | |
| } | |
| ); | |
| }; | |
| if (body.hasClass('mobile')) { | |
| if (body.hasClass('mobile-enabled')) { | |
| A.all('ul').each( | |
| function (f) { | |
| if (f.hasClass('child-menu') || f.hasClass('grandchild-menu') && !f.hasClass('aui-helper-hidden')) { | |
| f.addClass('aui-helper-hidden'); | |
| } | |
| } | |
| ); | |
| if(toggle) { | |
| toggle.on( | |
| 'click', | |
| function (e) { | |
| toggleAction(); | |
| } | |
| ); | |
| } | |
| navContent.all('.has-child-marker').each( | |
| function (e) { | |
| e.on( | |
| 'click', | |
| function (event) { | |
| menuTrigger(event); | |
| } | |
| ); | |
| } | |
| ); | |
| body.on( | |
| "gesturemovestart", | |
| function (e) { | |
| var item = e.currentTarget; | |
| var MIN_SWIPE = 20; | |
| var target = e.target; | |
| item.setData("swipeStart", e.pageX); | |
| item.once( | |
| "gesturemoveend", | |
| function (e) { | |
| var swipeStart = item.getData("swipeStart"); | |
| var swipeEnd = e.pageX; | |
| var isSwipeLeft = (swipeStart-swipeEnd) > MIN_SWIPE; | |
| var isSwipeRight = (swipeEnd-swipeStart) > MIN_SWIPE; | |
| var navOut = body.hasClass('nav-show'); | |
| var swipeLeft = isSwipeLeft && navOut; | |
| var swipeRight = isSwipeRight && !navOut; | |
| if (swipeLeft || swipeRight) { | |
| toggleAction(); | |
| } | |
| } | |
| ) | |
| } | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment