Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created December 4, 2012 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/4203930 to your computer and use it in GitHub Desktop.
Save walterdavis/4203930 to your computer and use it in GitHub Desktop.
var panel = $('yourElement').store('width', $('yourElement').getWidth()).setStyle('width:0');
$('button').observe('click', function(evt){
if(panel.getWidth() < panel.retrieve('width')){
panel.morph('width: ' + panel.retrieve('width') + 'px', {duration: 0.4});
}else{
panel.morph('width: 0', {duration: 0.4});
}
}).setStyle('cursor:pointer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment