Skip to content

Instantly share code, notes, and snippets.

@cwoodcox
Created May 29, 2012 21:53
Show Gist options
  • Save cwoodcox/2831021 to your computer and use it in GitHub Desktop.
Save cwoodcox/2831021 to your computer and use it in GitHub Desktop.
$ ->
$("#nav-main li").click ->
toExpand = $ $(this).data("expand")
$(".nav-sub").hide()
toExpand.show()
if $(this).hasClass("open")
$("#nav-sub-group").height(0) unless $(this).siblings().hasClass("open")
$("#nav-main li").removeClass("open")
else
$("#nav-sub-group").height toExpand.height() + parseInt(toExpand.css 'padding-top') + parseInt(toExpand.css 'padding-bottom')
$("#nav-main li").removeClass("open")
$(this).addClass("open")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment