Skip to content

Instantly share code, notes, and snippets.

@wnstn
Created August 8, 2012 21:01
Show Gist options
  • Save wnstn/3298759 to your computer and use it in GitHub Desktop.
Save wnstn/3298759 to your computer and use it in GitHub Desktop.
subnav compiled
(function() {
$(function() {
return $('.subnav a').on('click', function(event) {
var changeContent, currentSection, page;
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
});
return $('.animate-in').ajaxSuccess(function() {
$(changeContent).spin(false);
return 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