Skip to content

Instantly share code, notes, and snippets.

@jamierumbelow
Last active August 29, 2015 14:01
Show Gist options
  • Save jamierumbelow/fca3fd9f19efded163ce to your computer and use it in GitHub Desktop.
Save jamierumbelow/fca3fd9f19efded163ce to your computer and use it in GitHub Desktop.
$(".filter-list").find("input:checkbox").on "click", ->
childrenSelected = []
typeSelected = []
$('.filter-children input:checked').each -> childrenSelected.push($(this).attr('rel'))
$('.filters input:checked').each -> typeSelected.push($(this).attr('rel'))
selectors = []
if childrenSelected.length > 0
for child in childrenSelected
if typeSelected.length > 0
for type in typeSelected
selectors.push ".#{child}.#{type}"
else
selectors.push ".#{child}"
else
for type in typeSelected
selectors.push ".#{type}"
if selectors.length > 0
$('.timeline_element').hide()
$(selectors.join(', ')).show()
else
$('.timeline_element').show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment