Skip to content

Instantly share code, notes, and snippets.

@wnstn
Created August 8, 2012 21:00
Show Gist options
  • Save wnstn/3298737 to your computer and use it in GitHub Desktop.
Save wnstn/3298737 to your computer and use it in GitHub Desktop.
subnav js
$ ->
$('.subnav a').on 'click', (event) ->
event.preventDefault()
currentSection = '#' + $(this).closest('section').attr('id')
changeContent = '#' + $(currentSection + ' .pjax-content').attr('id')
$(changeContent + ' .animate-out').animate({
opacity: 0.0,
'margin-left' : '-960px',
}, 500)
$(changeContent).spin()
page = $(this).attr('href')
$.pjax({
url: page,
container: changeContent
})
$('.animate-in').ajaxSuccess( ->
$(changeContent).spin(false)
console.log('success')
).animate({
opacity: 1.0,
'margin-left' : '0px',
}, 500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment