Skip to content

Instantly share code, notes, and snippets.

@PetterKraabol
Last active December 18, 2015 01:09
Show Gist options
  • Save PetterKraabol/5701234 to your computer and use it in GitHub Desktop.
Save PetterKraabol/5701234 to your computer and use it in GitHub Desktop.
This jQuery function slides a container out to the right, and comes back in from the left. jsFiddle: http://jsfiddle.net/Zarlach/wxHLP/
function slideContent(ele){
ele.animate({
opacity: 0,
marginLeft: '+=500'
}, 500, function() {
$(this).css('marginLeft', 'auto').css('marginRight', '+=500');
$(this).animate({
marginRight: '-=500',
opacity:1
}, 500, function(){
$(this).css('marginRight', 'auto');
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment