Skip to content
Snippets Groups Projects
Commit ef6ddffb authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Fix sidenav code for toggling, opening and closing

parent 00ac7265
No related merge requests found
......@@ -5,12 +5,11 @@
arrow = {}
animating = false
toggleArrow = (status) ->
if arrow.hasClass "top" or status? is -1
toggleArrow = (status = null) ->
if status is -1 or (status isnt 1 and arrow.hasClass "top")
arrow.removeClass "top"
arrow.addClass "bottom"
return
if not arrow.hasClass "top" or status? is 1
else
arrow.addClass "top"
arrow.removeClass "bottom"
......@@ -44,27 +43,22 @@
return invalid
return false;
toggleFlex = (status, callback = null) ->
toggleFlex = (status = null, callback = null) ->
return if animating == true
animating = true
if flexNav.opened or status? is -1
if status is -1 or (status isnt 1 and flexNav.opened)
flexNav.opened = false
flexNav.addClass "hidden"
setTimeout ->
animating = false
callback?()
, 350
return
if not flexNav.opened or status? is 1
else
flexNav.opened = true
# added a delay to make sure the template is already rendered before animating it
setTimeout ->
flexNav.removeClass "hidden"
, 50
setTimeout ->
animating = false
callback?()
, 500
setTimeout ->
animating = false
callback?()
, 500
openFlex = (callback = null) ->
return if animating == true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment