Skip to content

Instantly share code, notes, and snippets.

@ChickenFur
Last active December 28, 2015 04:19
Show Gist options
  • Save ChickenFur/7442096 to your computer and use it in GitHub Desktop.
Save ChickenFur/7442096 to your computer and use it in GitHub Desktop.
Menu Control in Coffee Script
setCurrentTab = (newTabNum)->
$navTabs = $(".pimco-container .nav-tab")
for tab in $navTabs
$tab = $(tab)
if $tab.data().tabNum is newTabNum
$tab.addClass("active")
$(".tab-content#{newTabNum}").show()
else
$tab.removeClass("active")
$(".tab-content#{$tab.data().tabNum}").hide()
$(".container .nav-tab").on "click", () ->
console.log "setting tag to", $(this).data().tabNum
setCurrentTab($(this).data().tabNum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment